Part 1: Install mysql
1. Use apt to install
sudo apt update
sudo apt install -y mysql-server
After the installation is complete, it will end automatically and no password is required.
2. The default installation here is mysql8.0 version, because I did not enter a password; so I cannot use mysql -u root -p to enter mysql
You need to execute this command (sudo must be added) to enter mysql without password:
sudo mysql -uroot
Then use sql to update the user password:
alter user 'root'@'localhost' identified with mysql_native_password by 'your_new _password';
Then you can use the password to log in to the mysql root account
Part II: Authorizing Remote Use
1. If authorized directly, an error will be reported
2. Because when modifying the secret of the root account, the address is localhost, so you cannot directly authorize other hosts to access here. You need to modify the host of the root account to allow access to all hosts, and then authorize.
3. Remember to refresh the permissions after modifying the host of the root account, otherwise you will not be able to authorize, and you must refresh the permissions after authorization.
Then you can use tools such as navicat to connect and access remotely!