mysql 创建用户并授权

创建用户并授权:

--首先是用root 登陆系统 

create user ‘zhongxiaohong’@‘localhost' identified by 'zhongxiaohong';

 create user 'zhongxiaohong'@'%' identified by 'zhongxiaohong';

 create database product DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

grant all privileges on `product`.* to 'zhongxiaohong'@'localhost' identified by 'zhongxiaohong' with grant option;

grant all privileges on `product`.* to 'zhongxiaohong'@'%' identified by 'zhongxiaohong' with grant option;

导出整个数据库:

mysqldump -h localhost -uroot -p123456 database > dump.sql

导入整个数据库:

mysql -uroot -pEnter Password: >


> source ~/business_db.sql

你可能感兴趣的:(mysql 创建用户并授权)