1.Add a login user and group for `mysqld' to run as:為‘mysqld’增添一個(gè)登陸用戶和組
shell> groupadd mysql
shell> useradd -g mysql mysql
2.解壓
shell> gunzip < mysql-5.0.15.tar.gz | tar -xvf --
shell> cd mysql-5.0.15
3.Configure the release and compile everything:配置和編譯給configure分配可執(zhí)行文件
shell> chmod +x configure
改變字符集為 GBK [默認(rèn)字符集為ISO-8859-1(Latin1)]
shell> ./configure --prefix=/usr/local/mysql --with-charset=gbk
shell> make
(字符集還有big5、cp1251、cp1257、czech、danish、dec8、dos、euc_kr、gb2312 gbk、german1、hebrew、 hp8、hungarian、koi8_ru、koi8_ukr、latin1、latin2、sjis、swe7、tis620、ujis、usa7、win1251或win1251ukr)
4.安裝所有東西
shell> make install
5.如果你想安裝選項(xiàng)文件,使用當(dāng)前存在的‘support-files’ 文件夾下的作為模板,例如:
shell> cp support-files/my-medium.cnf /etc/my.cnf
6.如果想mysqld每次開機(jī)自動(dòng)啟動(dòng)的話。cp -r support-files/mysql.server /etc/init.d/就行了
shell> cp -r support-files/mysql.server /etc/init.d/mysql
shell> cd /etc/rc.d/init.d
shell> chmod +x mysql
shell> /sbin/chkconfig --del mysql
shell> /sbin/chkconfig --add mysql
7.進(jìn)入安裝目錄
shell> cd /usr/local/mysql
8.如果你以前沒(méi)有安裝過(guò)MySQL,你必須創(chuàng)建一個(gè)MySQL準(zhǔn)許的表
shell> bin/mysql_install_db --user=mysql
9.將程序的所有權(quán)限給‘root’ ,并且把數(shù)據(jù)目錄的所有權(quán)給可以運(yùn)行‘mysqld’的用戶。假設(shè)MySQL的安裝目錄是(‘/usr/local/mysql’),命令如下所示:
把文件擁有權(quán)給‘root’
shell> chown -R root .
把數(shù)據(jù)目錄擁護(hù)權(quán)給‘mysql’用戶
shell> chown -R mysql var
把組的權(quán)限給'mysql'組
shell> chgrp -R mysql .
10.萬(wàn)事具備后,你就可以按照下面的命令測(cè)試并運(yùn)行你的MySQL了:
shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
shell> service mysql start
11.在一切正常后,要做的第一件事情是更改管理員的密碼。你可以運(yùn)行mysqladmin (請(qǐng)注意,此命令不一定在你的path中,所以最好是轉(zhuǎn)到此命令的目錄中直接執(zhí)行):
shell> cd bin
shell> ./mysqladmin -u root password *********
12.運(yùn)行其他用戶訪問(wèn)本機(jī):
shell> ./mysql -u root -p mysql
--------------------這里輸入你剛才修改的管理員密碼
mysql> update user set host='' where host='localhost' and user='root';
mysql> exit
Bye
13.修改mysql數(shù)據(jù)庫(kù)端口號(hào)
shell> vi /etc/my.cnf
--------------------修改里面的 port=**** 為你需要的端口號(hào)
14.重啟應(yīng)用
shell> service mysql restart
本文出自:億恩科技【www.allwellnessguide.com】
服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|