MySQL 新建用户和数据库

MySQL 新建用户和数据库

修改MySql的密码为qwe123
/usr/local/bin/mysqladmin -u root -p password qwe123

mysql设置root远程访问
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'qwe123' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

创建新的数据库和用户
create database weblm character set utf8;
grant all privileges on weblm.* to 'weblm'@'localhost' identified by 'weblm';
flush privileges;

删除创建的数据库和用户
delete from `mysql`.`db` where  `Host`='localhost' and `Db`='weblm' and `User`='weblm';
delete from `mysql`.`user` where  `Host`='localhost' and `User`='weblm';
drop database `weblm`;
flush privileges;

============= End

原文地址:https://www.cnblogs.com/lsgxeva/p/8472610.html