Archive
Posts Tagged ‘create database’
Some notes on MySQL
May 28, 2011
Leave a comment
Log in to MySQL as administrator:
mysql -u root -p
Show databases:
mysql> show databases;
Show tables in the database mysql:
mysql> use mysql; mysql> show tables;
Administration program for the mysqld daemon: mysqladmin.
Accessing phpmyadmin: http://localhost/phpmyadmin.
Another GUI administration program: mysql-admin (note the ‘-‘).
Create a database called “finance”:
$ mysqladmin -u root -p create finance
Create a user who can work on the previously created finance database:
mysql> GRANT select, insert, update, delete, create, drop, index, alter, create temporary tables, lock tables ON finance.* TO 'myuser'@'localhost' IDENTIFIED BY 'mypass';
Now we have a user called “myuser” with the password “mypass” who can work on the “finance” database from localhost only.
Log in with the newly created user:
$ mysql -u myuser -p mysql> use finance; mysql> show tables;
Categories: mysql
create database, create user