mysql 相关环境配置
1. mysql
版本要求 5.5 以上, 否则不支持 emoji 表情.
$ sudo apt-get install mysql-server $ sudo vim /etc/mysql/my.cnf # charset utf8mb4. mysql 5.5 required [client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init_connect='SET NAMES utf8mb4' $ sudo service mysql restart $ mysql -uroot -p # login and check mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%'; +--------------------------+--------------------+ | Variable_name | Value | +--------------------------+--------------------+ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4 | | character_set_system | utf8 | | collation_connection | utf8mb4_unicode_ci | | collation_database | utf8mb4_unicode_ci | | collation_server | utf8mb4_unicode_ci | +--------------------------+--------------------+ 10 rows in set (0.00 sec) # security grant mysql> use mysql; mysql> delete from user where user = ''; Query OK, 2 rows affected (0.00 sec)
2. Apache2
安装后, 默认路径指向 /var/www
$ sudo vim /etc/apache2/sites-enabled/000-default # by default in ubuntu: /var/www/html DocumentRoot /var/www
3. phpmyadmin
$ sudo apt-get install phpmyadmin $ sudo ln -s /usr/share/phpmyadmin/ /var/www