Home > mysql > Some notes on MySQL

Some notes on MySQL

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'

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 Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: