①解壓MySql安裝包
進(jìn)入到該安裝包的保存路徑后,通過下面的命令進(jìn)行解壓(解壓位置: ../bulid/)
tar zxvf mysql-5.1.53.tar.gz -C ../bulid/
②編譯
進(jìn)入到解壓后的文件夾下
安裝mysql前需要安裝一些linux系統(tǒng)軟件
aptitude install lib64ncurses5-dev OR libncurses5-dev
aptitude install g++
aptitude install automake
aptitude install autoconf2.13
autoreconf --force --install
aclocal; autoheader
libtoolize --automake --force
automake --force --add-missing; autoconf
編譯MySql,安裝到/usr/local/mysql-5.1.53
./configure '--prefix=/usr/local/mysql-5.1.53' '--with-mysqld-user=mysql' '--with-extra-charsets=all' '--with-named-curses-libs=/lib/libncurses.so.5' '--enable-assembler' '--with-charset=utf8'
make
③安裝
make install
④添加權(quán)限
groupadd mysql
useradd mysql -g mysql
./scripts/mysql_install_db --user=mysql
注:
mysql_install_db出現(xiàn)FATAL ERROR: Could not find mysqld錯誤時,
因?yàn)?etc/mysql/下出現(xiàn)了個my.cnf
解決方法:
mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
cp support-files/my-medium.cnf /etc/cnf
cd /usr/local/mysql-5.1.53/
chown -R root .
chown -R mysql var
chown -R mysql var/.
chown -R mysql var/mysql/.
chgrp -R mysql .
⑤運(yùn)行并查看是否安裝成功
/usr/local/mysql-5.1.39/bin/mysqld_safe --user=mysql &
lsof -i:3306 --查看3306端口是否是mysql在運(yùn)行。
./bin/mysql -root
exit --退出mysql
⑥修改mysql密碼
/usr/local/mysql-5.1.53/bin/mysqladmin -uroot password root
./bin/mysql -uroot -p --再次登錄
root --密碼
⑦添加別人能夠訪問的權(quán)限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
use mysql;
mysql> select User,host from user;
+------+-----------+
| User | host |
+------+-----------+
| root | % |
| root | 127.0.0.1 |
| | camp |
| root | camp |
| | localhost |
| root | localhost |
+------+-----------+
6 rows in set (0.00 sec)
注:編譯或安裝過程中可能會因缺少某些文件而導(dǎo)致error
則根據(jù)error提示的信息,先安裝缺少的文件再重新編譯安裝
error例;
checking for termcap functions library... configure: error: No curses/termcap library found
安裝install lib64ncurses5-dev后則此錯誤就可避免
通過命令 「aptitude search 查找內(nèi)容」查找相應(yīng)的文件
通過命令 「aptitude install 安裝文件名」進(jìn)行安裝
posted on 2011-12-21 20:28
大鳥 閱讀(225)
評論(0) 編輯 收藏