第五部分:搭建Ubuntu 14.04 LTS开发环境日志

安装MariaDB和PHP

$ sudo apt install mariadb-server
$ sudo apt install php5 php5-mysqlnd php5-mcrypt php5-gd php5-curl

将MariaDB的字符编码更改为UTF-8。

$ cd /etc/mysql
$ sudo cp -p my.cnf my.cnf.org
$ sudoedit my.cnf
$ diff -u my.cnf my.cnf.org
--- my.cnf      2016-03-19 17:16:06.000000000 +0900
+++ my.cnf.org  2014-02-20 06:18:21.000000000 +0900
@@ -32,7 +32,6 @@
 #
 # * Basic Settings
 #
-character-set-server = utf8
 user           = mysql
 pid-file       = /var/run/mysqld/mysqld.pid
 socket         = /var/run/mysqld/mysqld.sock
$

请重新启动MariaDB。

$ sudo service mysql restart

查询MariaDB的字符集编码

$ mysql -uroot -p
MariaDB [(none)]> 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.01 sec)

MariaDB [(none)]> quit
广告
将在 10 秒后关闭
bannerAds