Mysql 命令行

 2022-11-16    0 条评论    73214 浏览

mysql

创建用户

登录

mysql -u 用户 -p密码

创建本地访问的用户

create user '用户名'@'localhost' identified by '密码';

创建远程可访问的用户

create user '用户名'@'%' identified by '密码';

指定可本地访问

grant all privileges on *.* to 用户名@"localhost" identified by "密码"

刷新

flush privileges;

命令行执行sql脚本

/路径/bin/mysql -h127.0.0.1 -u用户名 -p -P端口 -Dsoc<脚本.sql