#### 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入门