MySQL数据库安装以及常用命令

java之路第一天—MySQL数据库安装以及常用命令

(1)MySQL安装:链接http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html

(2)通过MySQL命令行修改:(编码可选)

mysql> set character_set_client=utf8;

mysql> set character_set_connection=utf8;

mysql> set character_set_database=utf8;

mysql> set character_set_results=utf8;

mysql> set character_set_server=utf8;

设置成功后 执行  status;命令

修改数据库的字符集mysql>use mydb

mysql>alter database mydb character set utf8;

8

创建数据库指定数据库的字符集

mysql>create database mydb character set utf8;

网摘:http://jingyan.baidu.com/album/03b2f78c68b0c15ea237ae8d.html?picindex=1

(3)数据库常用命令

进入MySQL : mysql -uroot -p  输入密码即可;

mysql> show databases[喝小酒的网摘]http://blog.hehehehehe.cn/a/1854.htm

-> ;

mysql> show tables;

MySQL显示命令

二、显示命令

1、显示数据库列表。

show databases;

2、显示库中的数据表:

use mysql;

show tables;

3、显示数据表的结构:

describe 表名;

4、建库:

create database 库名;

5、建表:

use 库名;

create table 表名 (字段设定列表);

6、删库和删表:

drop database 库名;

drop table 表名;

7、将表中记录清空:

delete from 表名;

8、显示表中的记录:

select * from 表名

[喝小酒的网摘]http://blog.hehehehehe.cn/a/1854.htm

你可能感兴趣的:(MySQL数据库安装以及常用命令)