- 安装
- sudo apt update
- sudo apt upgrade
- sudo apt install mysql-server
- sudo apt install mysql-client
发现安装过程中没有提示设置密码:
-
vim /etc/mysql/debian.conf
# Automatically generated for Debian scripts. DO NOT TOUCH! [client] host = localhost user = debian-sys-maint password = dBZPJZTi2IezJ9G2 socket = /var/run/mysqld/mysqld.sock [mysql_upgrade] host = localhost user = debian-sys-maint password = dBZPJZTi2IezJ9G2 socket = /var/run/mysqld/mysqld.sock
-
mysql -u debian-sys-maint -p
-
输入密码:<dBZPJZTi2IezJ9G2>
-
use mysql update user set authentication_string=password('密码') where user='root'; update user set plugin='mysql_native_password'; flush privileges; quit /etc/init.d/mysql restart