dongyl
win下 配置免安装mysql
环境 :win10 mysql 8.0+
1 管理员 cmd 进入 bin目录
.\mysqld.exe --initialize -user=mysql --console
会出现如下 :
2020-11-13T12:45:10.649568Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: c+x<FbZq(3yo
其中 c+x<FbZq(3yo 是密码
2 .\mysqld -install
3 net start mysql (8.0 需启动)
4 mysql -u root -p
输入密码
mysql> update user set password=password("123456") where user="root";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '("123456") where user="root"' at line 1
mysql> update user set password="123456" where user="root";
ERROR 1046 (3D000): No database selected
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> update user set password=123456 where user="root";
ERROR 1046 (3D000): No database selected
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.13 sec)
5 alter user 'root'@'localhost' identified by 'root';
6 use mysql
7 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY "123456";
8 FLUSH privileges; 刷新权限
以及在 环境变量中设置