Create User | Assign Password | Display Privilege | Remove User

Move My.ini to [Windows\System32]

Default Installation
-2 DBs
1. mysql (6 tables )
-user ( who can login & if user has global privilege )
-db ( specify db user allowed to access)

-Default account : root (without pass)
-If fails do following: 'Mysqld or Mysqld-nt' then 'Mysql -u root'
> mysql -u root (login as default user: superuser)

1. Create user (select, insert, update, delete, drop, create)

 

* In this example, dbuser can only access the database from localhost.
GRANT SELECT, INSERT, UPDATE, DELETE ON chian.* TO dbuser@localhost IDENTIFIED BY "myPassword";

GRANT All Privileges on Chian.* to dbuser@'127.0.0.1' identified by ' myPassword';

* In this example, dbuser can only access the database from anysites.
GRANT SELECT, INSERT, UPDATE, DELETE ON chian.* TO dbuser@"%" IDENTIFIED BY "myPassword";

Back

Display User privilege

SELECT Host, Db, User, Select_priv, Insert_priv,
Update_priv, Delete_priv
FROM db
WHERE User='dbuser';

Back

2. Assign Account Password

 

> SET PASSWORD FOR 'jeffrey'@'%' = PASSWORD('biscuit');
eg. >user mysql
> SET PASSWORD FOR 'chian'@'localhost' = OLD_PASSWORD('enusnt');
> Flush Privileges;

> UPDATE user SET Password = PASSWORD('bagel')
-> WHERE Host = '%' AND User = 'francis';
> FLUSH PRIVILEGES;

>mysqladmin -u username password new_password

Back

3. Remove User


> DROP USER username;
> DELETE FROM mysql.user
> WHERE User='user_name' and Host='host_name';
> FLUSH PRIVILEGES;

Back

 

 

@copyright of Soon Lim. All right reserved