Detailed explanation of how to manually deploy a remote MySQL database in Linux

Detailed explanation of how to manually deploy a remote MySQL database in Linux

1. Install mysql Run the following command to update the YUM source.

rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

Run the following command to install MySQL.

yum -y install mysql-community-server

Run the following command to view the MySQL version number.

mysql -V

The returned result is as follows, indicating that MySQL is installed successfully.

mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper

2. Configure MySQL Run the following command to start the MySQL service

systemctl start mysqld

Run the following command to set the MySQL service to start automatically at boot.

systemctl enable mysqld

Account information (usually the default is root, 123456. If you forget the password, you can skip it and directly log in to the database as root and then change the password)

//Steps//First find the mysql configuration file my.cnf, usually in /etc/my.cnf
//cd into /etc and edit it directly with vim my.cnf (it seems that the username and password are at the top of the file)
// Add skip-grant-tables under the [mysqld] tag // Press esc to exit editing: press wq to save and exit // Then restart the server service mysqld restart to make the changes take effect // mysql -u root to directly enter the database // Then change the password mysql> USE mysql;
//mysql> UPDATE user SET Password = password ('new password') WHERE //User = 'root';
//mysql> flush privileges;
//mysql> quit
// After changing the password, change the configuration file back and delete the added sentence, then restart the server again // Then you can use mysql -u root -p to enter your new password to enter

3. Remote access to MySQL database

I am using Navicat to connect to the MySQL database configured remotely in Alibaba Cloud

After running the following command, enter the root user's password to log in to MySQL.

mysql -uroot -p

If an error like the one below appears, don’t panic.

insert image description here

The error code is 1130, ERROR 1130: Host XXXX is not allowed to connect to this MySQL server. This may be due to a problem with the user permissions for remote connections. The solution is to log in to MySQL on the server and change the "host" field value in the "user" table in the "mysql" database from "localhost" to "%".
Here is the sql statement:

mysql -u root -p 
mysql;use mysql; 
mysql;select 'host' from user where user='root'; 
mysql;update user set host = '%' where user = 'root'; 
mysql;flush privileges; 
mysql;select 'host' from user where user='root';

The first sentence is to log in as the privileged user root. The second sentence is to select the MySQL database. The third sentence is to view the host value of the user table in the MySQL database (that is, the host IP name for connection access).
Fourth sentence: Modify the host value (add the host IP address with the wildcard %). Of course, you can also directly add the IP address. Fifth sentence: Refresh MySQL system permission related tables. Sixth sentence: Check the user table again to see if there are any changes.
Restart mysql.

This concludes this article on how to manually deploy a remote MySQL database in Linux. For more information on manually deploying a remote MySQL database, please search 123WORDPRESS.COM's previous articles or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Tutorial on installing MySQL under Linux
  • mysql8.0.23 linux (centos7) installation complete and detailed tutorial
  • Introduction to the process of installing MySQL 8.0 in Linux environment

<<:  Front-end development must learn to understand HTML tags every day (1)

>>:  Detailed explanation of the murder caused by a / slash in Nginx proxy_pass

Recommend

Details of using vue activated in child components

Page: base: <template> <div class="...

Vue implements the full selection function

This article example shares the specific code of ...

Linux file management command example analysis [display, view, statistics, etc.]

This article describes the Linux file management ...

Native JS to implement drag position preview

This article shares with you a small Demo that ad...

How to configure Hexo and GitHub to bind a custom domain name under Windows 10

Hexo binds a custom domain name to GitHub under W...

How to implement the webpage anti-copying function (with cracking method)

By right-clicking the source file, the following c...

Vue custom v-has instruction, steps for button permission judgment

Table of contents Application Scenario Simply put...

MySQL trigger principle and usage example analysis

This article uses examples to explain the princip...

MySQL index for beginners

Preface Since the most important data structure i...

Optimization analysis of Limit query in MySQL optimization techniques

Preface In actual business, paging is a common bu...

Example of using store in vue3 to record scroll position

Table of contents Overall Effect Listen for conta...

Things to note when writing self-closing XHTML tags

The img tag in XHTML should be written like this:...

mysql5.7.17.msi installation graphic tutorial

mysql-5.7.17.msi installation, follow the screens...