日期:2014-05-16 浏览次数:20873 次
windows:安装 mysql成功后,除了程序栏里的登录窗口外,在cmd里也可以登录mysql。
???????? 转到mysql的目录, cd 进入目录,dir 显示目录下的子文件、文件夹。
???????? mysql -u root [-h localhost] -p 输入密码
终端不能输入utf8中文,incorrect string value
???????? 因为cmd窗口默认gbk字符集不可修改,所以修改mysql的字符集
???????? show variables like '%character&' ;
????????? Variable_name??????????? | Value
--------------------------+------------------------------------------------
?character_set_client???? | utf8
?character_set_connection | utf8
?character_set_database?? | utf8
?character_set_filesystem | binary
?character_set_results??? | utf8
?character_set_server???? | utf8
?character_set_system???? | utf8
?character_sets_dir?????? | C:\ReiyenKart\MySQL Server 5.1\share\charsets\
?????? 修改其中的client和results为gbk
? ? ?? set ?? character_set_client =gbk
?????? 这样修改之后只对当前session有效,重开之后恢复原状。 所以还是修改my.ini的default-character-set=gbk。这个属性有两个,第一个是gbk,第二个是utf8.不知道是为什么。
这样修改之后变量是这样的:
+--------------------------+------------------------------------------------+
| Variable_name??????????? | Value????????????????????????????????????????? |
+--------------------------+------------------------------------------------+
| character_set_client???? | gbk??????????????????????????????????????????? |
| character_set_connection | gbk??????????????????????????????????????????? |
| character_set_database?? | utf8?????????????????????????????????????????? |
| character_set_filesystem | binary???????????????????????????????????????? |
| character_set_results??? | gbk??????????????????????????????????????????? |
| character_set_server???? | utf8?????????????????????????????????????????? |
| character_set_system???? | utf8?????????????????????????????????????????? |
| character_sets_dir?????? | C:\ReiyenKart\MySQL Server 5.1\share\charsets\ |
+--------------------------+------------------------------------------------+
linux:解决乱码问题(黄金五步法) linux类似
?????? 1.mysql -uroot --character-set=utf8;
?????? 2.create database 库名 character set=utf8;
?????? 3.use 库名;
?????? 4.set names utf8;
?????? 5.建表
?mysql里几种文本:tinytext 非常小的文本串 || text 小文本串
??????????????????? mediumtext 中等文本串?? || longtext 大文本串
?
mysql 命令行导出数据库? mysqldump -uroot -p???? reiyenkart?? >c:/a.sql
?????????????????????????????????????????????????????? 用户名?? 密码?? 库????????????? 备份的目录,文件