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

jQuery implements percentage scoring progress bar

This article shares the specific code of jquery t...

MySQL Basics Quick Start Knowledge Summary (with Mind Map)

Table of contents Preface 1. Basic knowledge of d...

Guide to using env in vue cli

Table of contents Preface Introduction-Official E...

SVG button example code based on CSS animation

The specific code is as follows: <a href="...

Let's learn about JavaScript object-oriented

Table of contents JavaScript prototype chain Obje...

Comparative Analysis of UI Applications of Image Social Networking Sites (Figure)

In our life, work and study, social networks have ...

Enterprise-level installation tutorial using LAMP source code

Table of contents LAMP architecture 1.Lamp Introd...

Modularity in Node.js, npm package manager explained

Table of contents The basic concept of modularity...

Common problems in implementing the progress bar function of vue Nprogress

NProgress is the progress bar that appears at the...

24 Practical JavaScript Development Tips

Table of contents 1. Initialize the array 2. Arra...

How to completely delete and uninstall MySQL in Windows 10

Preface This article introduces a tutorial on how...

In-depth analysis of JDBC and MySQL temporary tablespace

background Temporary tablespaces are used to mana...

Ideas and codes for realizing magnifying glass effect in js

This article example shares the specific code of ...

MySQL Series 10 MySQL Transaction Isolation to Implement Concurrency Control

Table of contents 1. Concurrent access control 2....