mysql中的基本帐户操作

I have finashed mysql installation and need to change root password to “123456”

(original password is null)

cd ../mysql/bin/

mysqladmin -u root -p password 123456

click enter key if sytem request password.

confirm new password

mysql -u root -p

input password “123456” ,pressing enter, you can login mysql

 

add an user test and set it’s password as “123456”, only allow this user login mysql

from client 192.168.1.5, and user test has all permission on any database and tables.

授予所有权限 *.* to [email protected] identified by “123456”;

 

add an user test and set it’s password as “123456”, allow this user login mysql from

any client, and user test has all permission on any database and tables.

授予所有权限 *.* to test@’%’ 由 “123456”;

 

check current user

select user();

switch to mysql database

使用mysql;

check all details about table user

选择 * from user \G;

 

check user,密码,host information of table user

select user,密码,host from user;

 

generate userccand set it’s password as “123456” , only allow this user login mysql from

本地主机.

create user ‘cc’@’localhost’ 由“123456”标识;

 

remove all users which only be allowed login mysql from localhost.

delete from mysql.user where user=’ccand host=’localhost’;

发表评论