命令:
1:MySQL 设置root密码:
mysqladmin -u root password "1234"
2:MySQL 修改root密码:
mysqladmin -u root password oldpass "newpassword"
3:列出MySQL所有的字符集:
SHOW CHARACTER SET;
4:当前MySQL字符集设置:
SHOW VARIABLES LIKE 'character_set_%';
5:显示数据库字符集设置:
SHOW CREATE TABLE 数据库名;
6:修改数据库字符集设置:
alter datebase 数据库名 default character set 'utf-8';
7:修改数据库表字符集:
alter table 表名 default character set 'utf-8';
8:建库时指定字符集:
create database 数据库名 default charactor set gbk collate gbk_chinese_ci:
-show databases; //显示所有数据名
- use mydb; //打开“mydb”这个数据库
-show tables; //显示当前数据库的所有表名
-select *from student; //显示student表中的所有记录
-select *from student where saddress='湖南长沙'; //显示(查询)saddress='湖南长沙'的所有记录
-select sno,sname,saddressfrom student; //显示student表中的指定字段
-insertinto student values(8000,'Jack','1995-1-1','中国北京'); //向student表插入一条记录
-deletefrom student where sname='heihei'; //删除指定行
-update studentset sname='Rose'where sno='1009';
-insertinto student (sno,sname)values ('8001','aaaa');//只插入指定的列
//显示表结构
-showcreate table sstud;//查看详细信息
-altertable sstud add column aaint;//修改表结构--添加一列
-altertable sstud drop column aa;//修改表结构--删除一列
-droptable sstud;//删除stud表
-dropdatabase
aa;//删除数据库