For the first time in the Linux environment to configure mysql, it is really twists and turns, So we hereby record Step 1: download and install MySQL terminal input: sudoapt-getinstallmysql-servermysql-clientStep2: confirm the address of the MySQL Host terminal input: ifconfig, the inet address of eth0 is then remotely connected to port 3306 of the above ip address (if it has not been changed). If it is successfully connected, it will certainly be OK. If it cannot be connected, the following may exist:
The first time I configured mysql in Linux is really tortuous, so I would like to record
Step 1: download and install MySQL
Terminal input: sudo apt-get install mysql-server mysql-client
Step 2: confirm the address of the MySQL host
Terminal input: ifconfig. the inet address of eth0 is
Then remotely connect to port 3306 of the above ip address (if it has not been changed). If the connection is successful, it will certainly be OK. If the connection fails, the following problems may occur:
Error 2003 ]:
This error occurs because IP binding is enabled in the MySQL configuration and only access from the Local Machine (127.0.0.1) is allowed. Therefore, you need to modify this configuration.
Sudo vi/etc/mysql/my. cnf
FindBind-address = 127.0.0.1This line, comment it (add # At the beginning of the line)
Save and exit. Restart MySQL.
Sudo/etc/init. d/mysql restart
Error 1130 ]:
This error occurs because the account used for remote logon is not authorized to log on to the current IP address. To put it bluntly, each account has one or more IP addresses allowed to log on, for example, the root account has localhost and 127.0.0.1 by default, but far
The IP address of the ECS instance is not allowed. Therefore, you must add the logon permission for this IP address to the account you are using.
First, let's take a look at the IP address logon permissions of this account.
Log on to mysql on Ubuntu Terminal
InputMysql-u root-p
Enter Password
After successful login, enter the following command:
1.Use mysql
2.Select Host from user where user = 'user name to be queried, such as root'
The query results will list the IP addresses allowed by the user root to log on. The error 1130 is reported on the current remote machine because the IP address is not allowed. Therefore, there are two options for remote login. The first option is to add the IP address of the remote machine, and the second option is to directly add an arbitrary IP address (%), Any remote address can be accessed, depending on the needs
Add method:
Because the statement for copying a whole record is too long and troublesome, you can simply change one of localhost and 127.0.0.1 to the address to be released.
For example:
Update user set Host = '%' where Host = '192. 100'; (Note that the end is a semicolon)
In this way, change the host of the record of host = 127.0.0.1 to % (representing any ip address)
Then
Flush privileges;(Note that the end is a semicolon.) This statement is used to refresh permissions.
Restart the MYSQL service.
Sudo/etc/init. d/mysql restart
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2