1.用tar解压文件mysql-8.0.17-winx64.zip到d盘,重命名mysql
2.配置环境变量
MYSQL_HOME=d:\mysql
path= %MYSQL_HOME%\bin
3.mysql根目录下新建my-default.ini,配置
[mysqld]
port=3306
datadir=E:\MySQL\Data
max_connections=1000
max_connect_errors=10
character-set-server=utf8
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password
default-character-set=utf8
port=3306
default-character-set=utf8
4.以管理员身份运行cmd,输入以下命令:
d:
cd mysql\bin
mysqld -initialize
mysqld --initialize
mysqld --initialize --console
//生成初始默认密码,报错,删除data下的err文件,密码: Cl?2a0e&9jRw
mysqld install
5.启动mysql服务器
net start mysql
mysql -u root -p
mysql>ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘hn123456Aa’;//修改新密码
mysql>show databases;
mysql>use mysql;
mysql>show tables;
mysql>select user,host,authentication_string from mysql.user;
创建用户
mysql>CREATE USER ‘ltbo99’@’%’ IDENTIFIED WITH mysql_native_password BY ‘hn123456Aa’;
检查用户
mysql>select user, host, plugin, authentication_string from user\G;
#授权所有权限
mysql>GRANT ALL PRIVILEGES ON . TO ‘ltbo99’@’%’;
#授权基本的查询修改权限,按需求设置
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON . TO ‘ltbo99’@’%’;
查看用户权限
show grants for ‘ltbo99’@’%’;
FLUSH PRIVILEGES;
QUIT
至此安装完毕,若有差漏还望告知。