View the current version Mysql database
MySQL> select version();
select version () command for Linux and windows, can be a variety of graphics-line client and the client (such as Navicat) executed in the MySQL command.
View database coding
MySQL> SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';
This command can view the current Mysql database of all encoding formats such as: character_set_server, character_set_connection, collation_server etc.
Modify the database encoding
Want to permanently modify the database coding need to modify configuration files, windows are my.ini, Linux is my.cnf.
With windows, for example, my my.ini file in C: \ Program Files (x86) \ MySQL \ directory under the MySQL Server 5.5.
I want to modify the encoding format utf8mb4 example.
tips: utf8mb4 because of special circumstances, MySQL Version: no less than 5.5.3, JDBC Driver Version: mysql connector versions later than 5.1.13
open my.ini, showing only need to modify the contents of
[client]
default-character-set = utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
collation-server=utf8mb4_unicode_ci
character-set-server=utf8mb4
After modifying the configuration file, restart must restart the Mysql service
Mysql stop and start services
In the Linux system:
1. Start:
service mysqld start
2. Stop:
service mysqld stop
3. Restart:
service mysqld restart
In the window system:
cmd Run as administrator.
tips: Under Windows can not directly restart (restart), only the first stop, and then start.
1. Start:
net start mysql
2. Stop:
net stop mysql