mysql8.x操作与mysql5.x有些许,综合记录一下。
windows、linux、macos基本类似:
1. 定位到目录(windows为例)
where mysqld
(windows) which mysql
(unix)
C:\Program Files\MySQL\MySQL Server 8.0\bin
2. 跳过验证
mysqld --console --skip-grant-tables --shared-memory
如果报错则先:
mysqld -remove MySQL
mysqld --initialize-insecure
3. 免密登录
mysql -u root
4. 修改密码
select authentication_string,host from mysql.user where user='root';
UPDATE mysql.user SET authentication_string='' WHERE user='root';
flush privileges;
exit
5. 重载服务
mysqld -install
留言