Mysql日常操作

创建用户并授权

grant all privileges on test.* to "test"@"localhost" identified by "123";   #创建test库,并授权允许test用户可以访问

Mysql库导出

mysqldump -u 用户名 -p  目标数据库 > 数据库名.sql

MySQL库导入

mysql -u 用户名 -p  目标数据库 < 数据库名.sql

更改root密码

set password for root@localhost = password('123'); 
原文地址:https://www.cnblogs.com/luchuangao/p/8393854.html