版权声明:更多信息请关注 wwws.shinians.com 官网 https://blog.csdn.net/zzhuan_1/article/details/82693210
- r官方下载地址:点击打开链接,解压并放置到你想要安装的目录,以MySQL8.0为例
- 在../MySQL8.0/目录下新建目录data和文件my.ini和内容为:
[mysqld]
port=3306
basedir=..\MySQL8.0
datadir=..\MySQL8.0\data
character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
default-storage-engine=INNODB
explicit_defaults_for_timestamp=true
[mysql]
default-character-set=utf8
[client]
default-character-set=utf8 - 以管理员运行命令行,进入../MySQL8.0/bin文件夹,执行命令mysqld --initialize,该命令需要一段时间,会在data目录创建一系列文件。PS:如果出现“Error while setting value 'NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER' to 'sql_mode'”错误,在my.ini文件sql_mode的行首添加“#”注释掉此参数
- 运行安装目录:mysqld --install,启动服务net start mysql,登录root用户:mysql -u root -p,输入临时密码:Mfk!j)ajH2uf(在data目录下的.err文件,A temporary password is generated for root@localhost: Mfk!j)ajH2uf)。
- 修改默认密码, alter user root@localhost identified by '新密码';
- 新建测试用户、数据库和表
新建用户:create user test@localhost identified by 'test';
新建数据库:create database test;
切换数据库:use test;
新建表:create table if not exists test(firstname char(20),lastname char(20));
插入数据:insert into test('Michael','Jackson');
原文链接:https://blog.csdn.net/MichaelMcCree/article/details/80484396
常见错误:
安装mysql Install/Remove of the Service Denied!错误的解决办法
解决办法:
打开cmd.exe程序的时候选择“用管理员身份打开”。
问题2:
mysql客户端连接服务端是报错:
Client does not support authentication protocol requested by server; consider upgrading MySQL client
解决方案:
USE mysql;
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘831015’;
FLUSH PRIVILEGES;