MySql几个常用操作

1. install mysql
reference: http://www.jz123.cn/text/2719438.html

2. login
MYSQL instlled in local: mysql -u root -p
login to remote host:mysql -h 192.168.9.168 -u root -p

3. check user information
select user,host,password from mysql.user;
select user,host from mysql.user;

4. check databases already exist
show databases;

5. add new database
drop database if exists msmail;
create database msmail;

6. use another database
use msmail;

7. check database which is using now
select database();

8. add user
grant all privileges on msmail.* to 'cc'@'%' identified by 'cc';

9. execute sql file
source d:/dir/msq.sql;
This entry was posted in Computer, Database. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

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