咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
wget http://www.landui.com/mysql-community-release-el6-5.noarch.rp
rpm -ivh mysql-community-release-el6-5.noarch.rpm 安装yum源
安装MySQL和php-mysql
[root@sample ~]#vim /etc/my.cnf 编辑MySQL的配置文件
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
找到
old_passwords=1
这一行,在这一行的下面添加新的规则,让MySQL的默认编码为UTF-8,添加
default-character-set = utf8
这一行
然后在配置文件的文尾填加如下语句:
[mysql]
default-character-set = utf8
启动MySQL服务
[root@sample ~]# chkconfig mysqld on
设置MySQL服务随系统启动自启动
[root@sample ~]# chkconfig --list mysqld
确认MySQL自启动
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
如果2--5为on的状态就OK
[root@sample ~]#/etc/rc.d/init.d/mysqld start
启动MySQL服务
Initializing MySQL database: [ OK ]
Starting MySQL: [ OK ]