Simple configuration-Allow mysql to be remotely called by other machines
MYSQl is installed on a linux server of the company. When I access the MySQL service through mysql-Front on the console of the client, the prompt that mysql server cannot be connected is displayed. Liehuo.net
Many people may have encountered this phenomenon. I will teach you three steps to implement remote mysql service calling. Veryhuo.com
1. log on to the server as the root user and create a new database.
Mysql> create database user;
Query OK, 1 row affected (0.00 sec) veryhuo.com
2. Create a user to allow access to the user database
Mysql> grant all privileges on user. * TO chaiqi @ localhost identified by "123456"
->;
Query OK, 0 rows affected (0.04 sec)
3. Set this user to allow remote access from all machines
Mysql> grant all privileges on user. * TO chaiqi @ "%" identified by "123456 ";
Query OK, 0 rows affected (0.00 sec)
Mysql> exit veryhuo.com
Log on to MySQL-Front and chaiqi/123456. Liehuo.net
Lie # fire # Network
Solution 2 ========================================================== =
Grant all privileges on *. * to chaiqi @ "localhost" identified by 'Password'
Grant all privileges on *. * to chaiqi @ "%" identified by 'Password'
Flush privileges;
Veryhuo.com
Liehuo.net
We recommend that you use the client controller-MySQL-Front (mysql-administrator is also good, but I am not particularly familiar with it) bkjia.com
Veryhuo.com
= Attachment
Veryhuo.com
Install MySQL veryhuo.com
Sudo apt-get install mysql-server liehuo.net
This should be very simple, and I don't think there is much problem with the installation, so I will not talk about it much. Let's talk about the configuration below. Powerful fireworks
Configure MySQL
Liehuo.net
Note: In Ubuntu, MySQL only allows local access by default. If you want access from other machines, you need to change the/etc/mysql/my. cnf configuration file! Next we will step by step:
Liehuo.net
The root user does not have a password after the default MySQL installation, so the root user should first enter: Strong & fire & net
$ Mysql-u root
-U root is used here because I am a general user (firehare). If-u root is not added, mysql will assume that it is a firehare logon. Note: I have not entered the root user mode here because it is unnecessary. In general, it is not necessary to enter the root user mode to operate the database in mysql. This is only possible when the database is set. Liehuo.net
After entering mysql, the most important thing is to set the root user password in Mysql. Otherwise, the Mysql service is no longer secure. Lie # fire # Network
Mysql> grant all privileges on *. * TO root @ localhost identified by "123456"; veryhuo.com
Note: I use 123456 as the root user password, but this password is not safe. Please use a password with a mix of uppercase and lowercase letters and numbers, and at least 8 characters.
Liehuo.net
In this case, the root user password in MySQL is set up, and then the database you need is created with the root user. Here I will take xoops as an example: bkjia.com
Mysql> create database xoops; veryhuo.com
Mysql> grant all privileges on xoops. * TO xoops_root @ localhost identified by "654321 ";
Helping customers
In this way, a xoops_roots user is created, which has all permissions on the database xoops. In the future, we will use xoops_root to manage the xoops database, instead of using the root user. This user's permissions will only be limited to the xoops database. Liehuo.net
If you want to implement remote access or control, you have to do two things: bkjia.com
1. lie # fire # Network
Mysql> grant all privileges on xoops. * TO xoops_root @ "%" identified by "654321"; bkjia.com
Allows the xoops_root user to log on to MySQL from any machine.
Liehuo.net
Second: veryhuo.com
$ Sudo gedit/etc/mysql/my. cnf veryhuo.com
Veryhuo.com in earlier versions
> Skip-networking => # skip-networking
Strong & fire & Network
New Version
Liehuo.net
> Bind-address = 127.0.0.1 => bind-address = your machine's IP address veryhuo.com
This allows other machines to access MySQL.
Liehuo.net