Linux 对mysql远程连接的授权操作
首先linux连接mysql数据库
授权:
grant all on *.* to 'root'@'%' identified by '' with grant option;
//允许账户root从任何主机连接到所有数据库(*.*)
grant all on test.* to 'user'@'%' identified by '' with grant option;
//允许账户user从任何主机连接到test数据库(test.*)释放远程授权:
revoke all on *.* from 'user'@'%';
//禁止用户user从任何主机访问所有数据库
revoke all on test.* from 'user'@'%';
//禁止用户user从任何主机访问test数据库flush privileges; //刷新系统授权表连接不上关闭防火墙
关闭防火墙命令:systemctl stop firewalld.service
开启防火墙:systemctl start firewalld.service
关闭开机自启动:systemctl disable firewalld.service
开启开机启动:systemctl enable firewalld.service
linux连接mysql数据库对数据库的操作的一些基本命令
/usr/local/mysql/bin/mysql -uroot -p //连接mysql数据库mysql其他命令:show databases; //显示数据库create database name; //创建数据库 use databasename; //选择数据库drop database name //直接删除数据库,不提醒show tables; //显示表 describe tablename; //显示具体的表结构select 中加上distinct去除重复字段mysqladmin drop databasename //删除数据库前,有提示。//显示当前mysql版本和当前日期select version(),current_date;