MySql安装及常用操作

MySql数据库是开源免费而且性能很不错的数据库。

1. 安装
安装配置的步骤可参考这里。

2. 登录
本机上的MYSQL:mysql -u root -p
连接到远程主机上的 MySQL:mysql -h 192.168.9.168 -u root -p

3. 查看用户信息
select user,host,password from mysql.user;
select user,host from mysql.user;

4. 查看系统已存在的数据库
show databases;

5. 添加数据库
drop database if exists msmail;
create database msmail;

6. 改变使用的数据库
use msmail;

7. 查看当前使用的数据库
select database();

8. 添加用户
grant all privileges on msmail.* to 'cc'@'%' identified by 'cc';
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