#### Linux系統開啟MySQL遠程連接
* * * * *
1. 連接數據庫
~~~
[root@izbp192gcqz9hrnj21lewuz ~]# mysql -uroot -pguFLVNJKJa -h127.0.0.1
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.36 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
~~~
2. 創建數據庫
~~~
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.08 sec)
mysql> CREATE DATABASE champion;
Query OK, 1 row affected (0.02 sec)
~~~
3. 授權遠程登錄數據庫
~~~
mysql> grant all privileges on champion.* to 'root'@'%' identified by 'guFLVNJKJa';
Query OK, 0 rows affected (0.05 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
~~~
2. 在服務器端開啟遠程訪問
首先進入mysql數據庫,然后輸入下面兩個命令:
~~~
grant all privileges on *.* to 'root'@'%' identified by 'password';
flush privileges;
~~~
* 第一個`*`是數據庫,可以改成允許訪問的數據庫名稱。
* 第二個 是數據庫的表名稱,代表允許訪問任意的表。
* `root`代表遠程登錄使用的用戶名,可以自定義。
* `%`代表允許任意ip登錄,如果你想指定特定的IP,可以把%替換掉就可以了
* `password`代表遠程登錄時使用的密碼,可以自定義
* `flush privileges;`是讓權限立即生效
~~~
grant all privileges on champion.* to 'root'@'%' identified by 'guFLVNJKJa';
flush privileges;
~~~
- 目錄
- W3School
- 工具
- 手冊
- 實驗
- 慕課
- Linux軟件安裝管理
- RPM包安裝
- yum安裝
- Linux系統管理
- ps_mem
- uname
- CentOS版本
- Linux服務管理
- Linux權限管理
- Linux 權限控制的基本原理
- Linux網絡管理
- Linux計劃任務
- Crontab
- 任務啟停
- 綜合用例
- 間隔任務
- 一次任務
- 跨天任務
- 輸出重定向
- Crontab任務權限
- 多任務
- 表達式
- 視頻教程
- 不知疲倦的時間表
- 發送郵件
- nginx
- nginx入門到實踐
- Nginx配置Web服務器
- 查看進程
- 配置步驟
- nginx升級
- 腳本升級
- systemctl 命令完全指南
- Linux 軟件安裝目錄
- 查看文件安裝路徑
- 書籍
- 《Linux Shell腳本攻略》
- 《循序漸進Linux》
- 課程
- Linux典型應用
- 網址
- 通信
- MySQL開啟遠程連接
- 防火墻
- 安全組規則
- Mailx
- 介紹
- 安裝
- 配置
- 發送郵件
- 163_email
- 安全
- Linux中root賬號和普通賬號有什么區別,root賬號為什么不能刪除?
- chmod改變文件權限
- SELinux入門