Ubuntu 12.04, installed MySQL, finished, changed the character compiled, the error. Feel very depressed.
Environment:
root@ubuntu:~# uname-a
Linux ubuntu 3.2.0-23-generic #36-ubuntu SMP Tue Apr 20:39:51 UTC x86_64 x86_64 x86_64 gnu/linux
Using the Apt-get install Mysql-server installed, and then changed the default character set, in the/etc/mysql/my.cnf inside of [mysqld] and [client] Riga
Default-character-set=utf8, restart is not.
root@ubuntu:~# service MySQL Start
Start:job failed to start
Read the system log, reported the following content
June 22:56:42 Ubuntu kernel: [4051.584941] init:mysql main process (4021) terminated with status 7
June 22:56:42 Ubuntu kernel: [4051.584981] init:mysql main process ended, respawning
June 22:56:43 Ubuntu kernel: [4052.134766] init:mysql Post-start process (4022) terminated with status 1
June one 22:56:43 ubuntu kernel: [4052.154739] type=1400 Audit (1339469803.511:40): apparmor= "STATUS" operation= "Profile_" Replace "name="/usr/sbin/mysqld "pid=4068 comm=" Apparmor_parser "
June 22:56:44 Ubuntu kernel: [4053.619246] init:mysql main process (4072) terminated with status 7
June 22:56:44 Ubuntu kernel: [4053.619296] init:mysql main process ended, respawning
June 22:56:45 Ubuntu kernel: [4054.248707] init:mysql Post-start process (4073) terminated with status 1
June one 22:56:45 ubuntu kernel: [4054.269778] type=1400 Audit (1339469805.627:41): apparmor= "STATUS" operation= "Profile_" Replace "name="/usr/sbin/mysqld "pid=4119 comm=" Apparmor_parser "
June 22:56:47 Ubuntu kernel: [4055.733347] init:mysql main process (4123) terminated with status 7
June one 22:56:47 ubuntu kernel: [4055.733389] init:mysql respawning too fast, stopped
root@ubuntu:~#
Tangled up for a long time, today accidentally test, accidentally solved the problem, oh, have to say, RP broke out.
The configuration file is as follows
root@ubuntu:/etc/mysql# CAT/ETC/MYSQL/MY.CNF |
Grep-v ' ^# ' [client] Default-character-set=utf8 #这里其实不用指定的, if you want to specify, use this instruction. Port = 3306 Socket =/var/run/mysqld/mysqld.sock [Mysqld_safe] socket =/var/ru
N/mysqld/mysqld.sock nice = 0 [mysqld] Character_set_server=utf8 #要使用这个命令, Default-character-set=utf8 will complain user = MySQL Pid-file =/var/run/mysqld/mysqld.pid socket =/var/run/mysqld/mysqld.sock por t = 3306 basedir =/usr DataDir =/var/lib/mysql tmpdir =/tmp Lc-messages-dir =/u Sr/share/mysql skip-external-locking bind-address = 127.0.0.1 Key_buffer = 16M max_allowed_pack ET = 16M Thread_stack = 192K Thread_cache_size = 8 Myisam-recover = BACKUP Query_cache_li MIT = 1M Query_cache_size = 16M Expire_logs_days = Ten max_binlog_size = 100M [Mysqldu MP] Quick quotE-names max_allowed_packet = 16M [MySQL] [isamchk] Key_buffer = 16M!includedir/ etc/mysql/conf.d/root@ubuntu:/etc/mysql#
As you can see, in the [client] and [MYSLQD] sections, the instructions used to set the character encoding are different.
And then restart MySQL.
root@ubuntu:/etc/mysql# service mysql restart MySQL stop/waiting mysql start/running, process 6981 Root@ubuntu:/etc/mys ql# mysql-uroot-p Enter password:welcome to the MySQL monitor. Commands End With;
or \g. Your MySQL Connection ID is 147 Server version:5.5.22-0ubuntu1 (Ubuntu) Copyright (c), Oracle and/or it S affiliates.
All rights reserved. Oracle is a registered trademark to Oracle Corporation and/or its affiliates.
The other names may is trademarks of their respective owners. Type ' help, ' or ' \h ' for help.
Type ' \c ' to clear the current input statement.
Mysql> Show variables like '%char% '; +--------------------------+----------------------------+
| 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.00 sec)