JAVA

Mariadb设置允许远程链接

2018-12-01  本文已影响0人  会理发的店小二

一. 修改数据表

1.进入 mariadb

mysql -u root -p

2.修改表

MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.00 sec)

3.查看修改后

MariaDB [mysql]> SELECT host,user,password from user;
+-----------+------+-------------------------------------------+
| host      | user | password                                  |
+-----------+------+-------------------------------------------+
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| %         | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+-----------+------+-------------------------------------------+
2 rows in set (0.00 sec)

二. 修改配置文件

/etc/mysql/mariadb.conf.d/50-server.cnfbind-address = 127.0.0.1# 注释掉

三.重启服务

 systemctl restart mariadb.service

四.远程链接

mysql -u root -proot -h 192.168.199.240 -D mysql

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.1.34-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

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

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

MariaDB [mysql]> 

搞定收工

上一篇下一篇

猜你喜欢

热点阅读