Well, to deploy MySQL on a Linux server, you should have a Linux server first.
Just execute a ordinary install command.
sudo apt install mysql-server
Then, you can check the installation.
And you can check the status of MySQL service. If not started, execute the command below and check again.
systemctl status mysql.service
After installation, we should reset our root password. First, enter MySQL.
sudo mysql -u root
Notice that, we have to use
sudoat the first time. Since it requires some extra privileges.
Then, we can change root password by the following SQL. Just replace 123456 with your favorite password. 🤪
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '123456';
Here, root can only access database from localhost. If we want to access it remotely, we can create a new user, and grant it all privileges.
CREATE USER 'admin'@'%' IDENTIFIED BY '123456';
I’m not sure if this is needed, but I guess its somewhat useful. Just comment
bind-address = 127.0.0.1 out, or change it to
Then, restart MySQL service.
sudo service mysql restart
Emm… One last step. Make sure the 3306 port is open. This can be found in the control panel of your server’s provider.
Now, we can use
admin to connect to our server remotely.
In Navicat, crate a new connection. And just fill it with the host, username and password. And you are good to go.
Well, this is it. Too late… go to bed! 😴