basic account operation in 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.

grant all privileges on *.* 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.

grant all privileges on *.* to test@’%’ identified by “123456”;

 

check current user

select user();

switch to mysql database

use mysql;

check all details about table user

select * from user \G;

 

check user,password,host information of table user

select user,password,host from user;

 

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

localhost.

create user ‘cc’@’localhost’ identified by ‘123456’;

 

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

delete from mysql.user where user=’cc’ and host=’localhost’;

Leave a Reply