first go to mysql install dir
mysql.exe -u root -p
enter your password.
check exist databases:
mysql>show databases;
create the db:
mysql>create database abc;
create the db use some charset beside default:
mysql>create database if not exists abc default charset utf8mb4 COLLATE utf8mb4_unicode_ci;
ps: for some unusual chinese characters utf8mb4 is better than utf8;
cerate user:
1.local user:
mysql> create user user1@localhost identified by '123';
2.remote user:
mysql> create user user1@'%'identified by '123';
授权:
所有权限
mysql> grant all privileges on abc.* to user1@localhost;
部分权限
mysql> grant select, insert, update, delete on abc.* to user1@'%';
mysql> flush privileges;
修改密码
mysql> set password for user1 =‘456’;
for mysql after 5.5
mysql> set password for user1 =password(‘456’);
mysql> flush privileges;
或者
mysql> use mysql;
mysql> update user set password = '456' where user = 'user1';
for mysql after 5.5
mysql> update user set password = password('456') where user = 'user1';
mysql> flush privileges;
阅读(1068) | 评论(0) | 转发(0) |