Ubuntu安装MySQL
使用'sudo apt install mysql-server'命令进行安装。安装过程中,可能没有出现设置密码的步骤,官方文档解释如下:
connect to the server:
If you used --initialize but not --initialize-insecure to initialize the data directory, connect to the server as root using the random password that the server generated during the initialization sequence:
shell> mysql -u root -p
Enter password: (enter the random root password here)
Look in the server error log if you do not know this password.
If you used --initialize-insecure to initialize the data directory, connect to the server as root without a password:
shell> mysql -u root --skip-password
After connecting, assign a new root password:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';