2011年8月1日 星期一

[mysql] create new user to mysql

We connect to the database using the root account. We show all available databases with the SHOW DATABASES statement.

mysql> CREATE DATABASE testdb;
Query OK, 1 row affected (0.02 sec)


We create a new testdb database. We will use this database throughout the tutorial.



mysql> CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'test623';
Query OK, 0 rows affected (0.00 sec)
mysql> USE testdb;
Database changed
mysql> GRANT ALL ON testdb.* TO 'testuser'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye


We create a new database user. We grant all privileges to this user for all tables of the testdb database.

0 意見:

張貼留言