如何在CentOS系統(tǒng)中安裝配置MySQ
2016-06-26 14:39:07
14040
wget http://www.tjdsmy.cn/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
這一行,在這一行的下面添加新的規(guī)則,讓MySQL的默認(rèn)編碼為UTF-8,添加
default-character-set = utf8
這一行
然后在配置文件的文尾填加如下語(yǔ)句:
[mysql]
default-character-set = utf8
啟動(dòng)MySQL服務(wù)
[root@sample ~]# chkconfig mysqld on
設(shè)置MySQL服務(wù)隨系統(tǒng)啟動(dòng)自啟動(dòng)
[root@sample ~]# chkconfig --list mysqld
確認(rèn)MySQL自啟動(dòng)
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
如果2--5為on的狀態(tài)就OK
[root@sample ~]#/etc/rc.d/init.d/mysqld start
啟動(dòng)MySQL服務(wù)
Initializing MySQL database: [ OK ]
Starting MySQL: [ OK ]
會(huì)員登錄
賬號(hào)登錄還沒(méi)有賬號(hào)?立即注冊(cè)