Home > Database > Mysql Tutorial > body text

Linux下配置Mysql允许远程访问详解_MySQL

WBOY
Release: 2016-06-01 13:01:04
Original
1154 people have browsed it

操作非常简单,就5步骤,如下:

1.进入 mysql:

/usr/local/mysql/bin/mysql -u root -p
Copy after login

2.使用 mysql库 :

use mysql;
Copy after login

3.查看用户表 :

SELECT `Host`,`User` FROM user;
Copy after login

4.更新用户表 :

UPDATE user SET `Host` = '%' WHERE `User` = 'root' LIMIT 1;
Copy after login
Copy after login

5.强制刷新权限 :

flush privileges;
Copy after login

完成以上步骤即可远程连接数据库了,上边关键的一句是

UPDATE user SET `Host` = '%' WHERE `User` = 'root' LIMIT 1;
Copy after login
Copy after login
其中%的意思是允许所有的ip远程访问,如果需要指定具体的某个ip就写上具体的ip即可

KO...

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