1 Install MySQL
The Ubuntu20.04 soft warehouse deploys MySQL8.0 version by default. The client is automatically installed when the MySQL server is installed.
1.1 Server installation
# 服务端,运行mysql服务,代码实现数据存取 sudo apt-get install mysql-server
1.2 MySQL version
2.1 Log in to MySQL
By default, the root user has no password, and you can log in directly by pressing Enter.
sudo mysql -u root -p
2.2 View the user table
Enter the mysql database and view the user table.
use mysql; select Host, User, plugin from user;
2.3 Modify root password
Modify the root password to be compatible with the old version of MySQL. Use the password to log in to MySQL.
mysql_native_password is compatible with the old version. Use a password to log in to MySQL.
- log in
mysql -u root - p
- View the root encryption method at this time
2.4 Authorize any host
The root user authorizes any host to log in, and modify the Host to%
update user set Host='%' where User='root';
2.5 Open remote login
Open the remote login and cancel the localhost binding:
Edit the file and comment bind-address.
2.6 Remote connection
- Ubuntu20.04 installs MySQL8.0 by default;
- MySQL8.0 default root password is empty, password authentication is auth_socket;
- Modify password login: mysql_native_password;
- Comment bind-address, remote login;