mysql 一些 常用命令

作者: JoeWcc | 来源:发表于2017-06-19 19:20 被阅读23次

登录Mysql:

mysql -u root -p

创建数据库:

create database testdb;

导入sql 文件:

source /data/webservice/test.sql;

导出sql 文件:

mysqldump -uroot -p 13waterdb > /data/webservice/13waterdb.sql

添加新用户:

create user 'test_user'@'%' identified by '123456';

% 代表 可以远程访问  如果只允许本地访问 则 缓存 localhost:

create user 'test_user'@'localhost' identified by '123456';

给新用户添加数据库访问权限

grant all privileges on `testdb`.* to 'test_user'@'%' identified by '123456';

刷新权限:

flush  privileges;

相关文章

网友评论

    本文标题:mysql 一些 常用命令

    本文链接:https://www.haomeiwen.com/subject/qnlnqxtx.html