MySQL Tips

Tips

修改mysql提示符

mysql -p --prompt '\u@\h \d>'
--......进入数据库
root@localhost (none)>

查看警告信息

SHOW WARNINGS;

查看表字段定义

两种方式

--显示出tdb_goods_cates表中的项目名称
DESC tdb_goods_cates; 
SHOW COLUMNS FROM tdb_goods_cates;

查看数据库或表原来的创建命令

SHOW CREATE DATABASE db1;
SHOW CREATE TABLE tb1;

--查看db的编码方式
root@localhost (none)>SHOW CREATE DATABASE t1;
+----------+---------------------------------------------------------------+
| Database | Create Database                                               |
+----------+---------------------------------------------------------------+
| t1       | CREATE DATABASE `t1` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+---------------------------------------------------------------+
1 row in set (0.00 sec)

修改db的编码方式

root@localhost (none)>ALTER DATABASE t1 CHARACTER SET = utf8;
Query OK, 1 row affected (0.00 sec)

root@localhost (none)>SHOW CREATE DATABASE t1;
+----------+-------------------------------------------------------------+
| Database | Create Database                                             |
+----------+-------------------------------------------------------------+
| t1       | CREATE DATABASE `t1` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+-------------------------------------------------------------+
1 row in set (0.00 sec)

你可能感兴趣的:(mysql)