📜  Mysql 使用本机密码安装 Ubuntu - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:07.939000             🧑  作者: Mango

代码示例1
#installation
sudo apt update
sudo apt install mysql-server
sudo service mysql status

sudo mysql_secure_installation
#You will be asked to configure the VALIDATE PASSWORD PLUGIN which is used to test the strength of the MySQL users' passwords. Press ENTER if you don’t want to set up the validate password plugin.
#On the next prompt, You should answer “Y” (yes) to all questions.
#the root user is authenticated by the auth_socket plugin by default.
#This means that you can’t authenticate as root by providing a password.

#password type change
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'very_strong_password';
FLUSH PRIVILEGES;
quit