码迷,mamicode.com
首页 > 数据库 > 详细

Linux(三十一)centos 7 mysql远程登录权限

时间:2015-04-01 19:53:45      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:

安装好mysql or mariadb后就使用界面管理工具进行管理了,推荐管理工具:SQLyog 、 Navicat for MySQL

1、防火墙要开放3306端口

2、对远程用户授权

[root@localhost backup]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.41-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.07 sec)

MariaDB [(none)]> grant all privileges on *.* to ‘TQ‘@‘192.168.85.1‘ identified by ‘密码‘;
Query OK, 0 rows affected (0.05 sec)

MariaDB [(none)]> grant all privileges on *.* to ‘root‘@‘192.168.85.1‘ identified by ‘密码‘;
Query OK, 0 rows affected (0.03 sec)

 

3、远程工具连接

技术分享

 

4、取消对远程用户的授权

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

MariaDB [mysql]> revoke all privileges on *.* from TQ@192.168.85.1;
Query OK, 0 rows affected (0.00 sec)

 

MariaDB [mysql]> delete from user where user=‘TQ‘;//记住删除用户,否则可以连接
Query OK, 1 row affected (0.03 sec)

MariaDB [mysql]> flush privileges;//更新权限表
Query OK, 0 rows affected (0.03 sec)

Linux(三十一)centos 7 mysql远程登录权限

标签:

原文地址:http://www.cnblogs.com/tq1226112215/p/4384589.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!