安装mysql-8.0.18时出现过的错误
1. 安装后登录不进去
尝试了网上的几种常用方法,均没有成功。最后还是初始化,又重新来了一遍才成功,具体步骤为:
- 在服务中将mysql关闭
- 在安装目录中重新安装:
/bin>mysqld install
- 初始化:
/bin>mysql --initialize --user=root --console
,之后会得到一个新的密码,请牢记! - 重新启动服务:
/bin>net start mysql
MySQL服务正在启动...
MySQL服务已经启动成功。
- 登录root:
/bin>mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor.
2. 修改root密码一直失败
- 原始方法:
mysql>set password=password('123456');
ERROR 1064 (42000): You have an error in your SQL syntax;check the manual that corresponds
to your MySQL server version for right syntax to use near 'password('123456')' at line 1
分析可能是因为我的是8.0.18版本,之前的方法不能用!
- 对于8.0.18版本可行的一种方法:
mysql>set password='123456';
Query OK