Home > Database > Mysql Tutorial > body text

Several solutions to the problem of being unable to connect to the mysql database remotely

黄舟
Release: 2016-12-15 11:24:18
Original
1124 people have browsed it

Three solutions to the problem of being unable to log in to the MySQL database remotely:
Apply fbysss to solve the problem of phpMyAdmin connecting to remote users:
2. Modify the config.inc.php file in the phpMyAdmin directory and find
$cfg['Servers'][$i] ['host'] is changed to the remote server address
$cfg['Servers'][$i]['user'] is changed to sss
$cfg['Servers'][$i]['password'] is changed to sss Password
It should be noted that grant all privilege does not grant the "grant" permission to the user. If you want to add it, you can directly use use mysql; update user set Grant_priv ='Y' in mysql to meet the requirements.
1. Log in to the remote Mysql server with the root account,
grant select, update, insert, delete on *.* to sss@192.168.0.114identified by "sss";
update user set host = '%' where user = 'sss ';
Exit mysql and execute under shell
#mysqladmin -u root -p [password] reload
#mysqladmin -u root -p [password] shutdown
#/etc/rc.d/init.d/mysqld start
Solution 2 for being unable to log in to the MySQL database remotely:
How to solve the connection between the client and the server (mysql): xxx.xxx.xxx.xxx is not allowed to connect to this mysql serv
1. Enter mysql and create a new user xuys :
Format: grant permission on database name.Table name user@login host identified by "user password";
grant select,update,insert,delete on *.* to xuys@192.168.88.234identified by "xuys1234";
View As a result, execute:
use mysql;
select host, user, password from user;
You can see that the xuys user just created is already in the user table. The host field represents the logged-in host. Its value can be IP or host name. Changing the value of the host field to % means that you can log in to the mysql server as user xuys on any client machine. It is recommended to set it to during development. %.
3. ./mysqld_safe --user-root &
Remember: any modification to the authorization table requires reloading, that is, step 3.
If you still cannot connect from the client after the above 3 steps, please perform the following operations to insert a record in the db table of the mysql database:
use mysql;
insert into db values('192.168.88.234','%', 'xuys','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y ');
update db set host = '%' where user = 'xuys';
Repeat steps 2 and 3 above.
Solution 1 for being unable to log in to the MySQL database remotely:
Trying to log in to MySQL Server using the MySQL Adminstrator GUI Tool, but the Server responded with an error message: Host '60-248-32-13.HINET-IP.hinet.net' is not allowed to connect to this MySQL server
This is because of a permissions issue. The processing method is as follows:
shell>mysql --user=root -p
Enter the password
mysql>use mysql
mysql>GRANT SELECT,INSERT,UPDATE,DELETE ON [db_name ].* TO [username]@[ipadd] identified by '[password]';
[username]: User code for remote login
[db_name]: Indicates the name of the database to be opened to users
[password]: Remote Login user password
[ipadd]: IP address or DNS Name after IP reverse check. In this example, the content needs to be filled in '60-248-32-13.HINET-IP.hinet.net', and the package letter must be enclosed in quotation marks. (')
(In fact, it is executed on the remote server, and the address fills in the IP address of the local host.)
If you want to open all permissions, please execute:
mysql>update user set select_priv='Y', Insert_priv='Y' , Update_priv='Y', delete_priv='Y', Create_priv='Y', Drop_priv='Y',Reload_priv='Y', shutdown_priv='Y', Process_priv='Y', File_priv='Y', Grant_priv ='Y', references_priv='Y',Index_priv='Y', Alter_priv='Y', Show_db_priv='Y', Super_priv='Y',Create_tmp_table_priv='Y',Lock_tables_priv='Y', Execute_priv=' Y',Repl_slave_priv='Y',Repl_client_priv='Y' where user='[username]';

The above are the contents of several solutions to the problem of being unable to remotely connect to the mysql database. For more related articles, please pay attention to the PHP Chinese website ( www.php.cn)!


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!