《Mysql入门mysql字符编码修改与查看方法》要点:
本文介绍了Mysql入门mysql字符编码修改与查看方法,希望对您有用。如果有疑问,可以联系我们。
导读:1,查看mysql字符集设置
mysql> show variables like collation_%;+----------------------+-----------------+| variable_name | va...
MYSQL学习1,查看mysql字符集设置
mysql> show variables like 'collation_%';
+----------------------+-----------------+
| variable_name | value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.02 sec)
mysql> show variables like 'character_set_%';
+--------------------------+----------------------------+
| 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 | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.02 sec)
MYSQL学习2,mysql字符编码与字符集的其它设置方法:
MYSQL学习修改数据库的字符集
mysql>use mydb
mysql>alter database mydb character set utf-8;
MYSQL学习创建数据库指定数据库的字符集
mysql>create database mydb character set utf-8;
MYSQL学习通过配置文件修改mysql字符编码:
修改/var/lib/mysql/mydb/db.opt
default-character-set=latin1
default-collation=latin1_swedish_ci
MYSQL学习为
default-character-set=utf8
default-collation=utf8_general_ci
MYSQL学习重启mysql数据库:
[root@jbxue ~]# /etc/rc.d/init.d/mysql restart
MYSQL学习1)、通过mysql命令行修改字符编码:
mysql> set character_set_client=utf8;
query ok, 0 rows affected (0.00 sec)
mysql> set character_set_connection=utf8;
query ok, 0 rows affected (0.00 sec)
mysql> set character_set_database=utf8;
query ok, 0 rows affected (0.00 sec)
mysql> set character_set_results=utf8;
query ok, 0 rows affected (0.00 sec)
mysql> set character_set_server=utf8;
query ok, 0 rows affected (0.00 sec)
mysql> set character_set_system=utf8;
query ok, 0 rows affected (0.01 sec)
mysql> set collation_connection=utf8;
query ok, 0 rows affected (0.01 sec)
mysql> set collation_database=utf8;
query ok, 0 rows affected (0.01 sec)
mysql> set collation_server=utf8;
query ok, 0 rows affected (0.01 sec)
MYSQL学习查看mysql字符编码:
mysql> show variables like 'character_set_%';
+--------------------------+----------------------------+
| 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 | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.03 sec)
mysql> show variables like 'collation_%';
+----------------------+-----------------+
| variable_name | value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.04 sec)
欢迎参与《Mysql入门mysql字符编码修改与查看方法》讨论,分享您的想法,维易PHP学院为您提供专业教程。
转载请注明本页网址:
http://www.vephp.com/jiaocheng/7423.html