mysql -uroot -peisccn -e " # mysql -u 账户,-p密码,-e开启linux命令行脚本模式执行数据库语句
Create Database If Not Exists eisc Character Set UTF8;
# 判断不存在数据库就创建数据库 eisc ,character [ˈkɛrɪktər] 字符,设置字符类型,collate [kəˈlet] 核对字符
grant all on eisc.* to 'eisc'@'%' identified by 'eisccn' WITH GRANT OPTION;
# 符号 % 是远程登录,locahost是本地登录
"
1.创建数据库语法
CREATE DATABASE IF NOT EXISTS testdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
# --判断数据库不存在就创建名称为“testdb”数据库,并设定编码集为utf8
create user 'test'@'localhost' identified by '1234';
# 1.新建用户: --创建了一个名为:test 密码为:1234 的用户;
# 远程登录:将"localhost"改为"%"
select user,host from mysql.user; # --查询用户
drop user test@localhost ; # --删除用户“test”
# --若创建的用户允许任何电脑登陆,删除用户:drop user test@'%';
set password for test =password('1122'); # 修改用户“test”的密码为“1122”
update mysql.user set password=password('1234') where user='test'
# --方法2,需要刷新;修改用户“test”的密码为“1234”
flush privileges; # --刷新
grant all privileges on 'testdb'.* to 'test'@'%' identified by '1234';
# --授予用户test通过外网IP对数据库“testdb”的全部权限
# privileges [ˈprɪvəlɪdʒ] 特殊权限; p lui v li jio s
flush privileges; # --刷新权限
grant create,alter,drop,select,insert,update,delete on testdb.* to test@'%';
# --授予用户“test”通过外网IP对于该数据库“testdb”中表的创建、修改、删除权限,以及表数据的增删查改权限
show grants for test; # --查看用户“test”权限
Powered by ddoss.cn 12.0
©2015 - 2025 ddoss
渝公网安备50011302222260号
渝ICP备2024035333号
【实验平台安全承诺书】
小绿叶技术社区,优化网络中,点击查看配置信息
主机监控系统: 安全防火墙已开启检查cc攻击-下载文件完成后等待10s 恢复访问,检查连接数低于峰值恢复访问
您的IP:10.8.227.66,2025-12-16 07:17:56,Processed in 0.02082 second(s).