mysql -u root -p
提示Warning, /usr/local/mysql/data is not owned by ‘mysql’ or ‘_mysql’
执行:
cd /usr/local/mysql
sudo chown -R _mysql data/
然后在启动就好了
CREATE DATABASE IF NOT EXISTS `micro-message` DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE = utf8_unicode_ci;
那么在这个数据库下创建的所有数据表的默认字符集都会是utf8了,注意后面这句话 “COLLATE utf8_general_ci”,大致意思是在排序时根据utf8变码格式来排序