ubuntu安装mysql
执行
sudo apt install mysql-server
启动mysql
sudo systemctl start mysql
查看状态
sudo systemctl status mysql
查看默认密码
sudo cat /etc/mysql/debian.cnf
直接进入mysql
sudo mysql
重置 root 账户密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
刷新权限
FLUSH PRIVILEGES;
设置远程登入
create user 'root'@'%' identified by '123456’;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;