ubuntu 快速安装和设置 mysql
直接使用:apt-get install mysql-server (最好先 update 一下) 安装
初始化密码为空则直接 mysql -uroot -p 登录(若有密码,则在安装日志中查询)
设置新的密码:
use mysql;
update mysql.user set authentication_string=password('root') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
退出 mysql 并 service mysql restart 重启 mysql 后密码生效
ps 设置登录权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;