歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

CentOS下如何安裝社區版MySQL 5.5.8

需要安裝Mysql5.5.8時,請參閱本文檔。

安裝Mysql5.5.8服務,提供公司CSFDP測試環境。正式環境也采用該版本的mysql

1.1.環境

PC機:IntelE5300 內存4G 硬盤500G

Mysql5.5.8

cmake2.8.3

2.1.安裝cmake

shell>tar zxvf cmake-2.8.3.tar.gz

shell>cd cmake-2.8.3

shell>./configure

shell>make

shell>make install

2.2. 安裝mysql

shell>tar zxvf mysql-5.5.8.tar.gz

shell>cd mysql-5.5.8

shell>cmake . \

-DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql \

-DCOMMUNITY_BUILD:BOOL=ON \

-DENABLED_PROFILING:BOOL=ON \

-DENABLE_DEBUG_SYNC:BOOL=OFF \

-DINSTALL_LAYOUT:STRING=STANDALONE \

-DMYSQL_DATADIR:PATH=/usr/local/mysql/data \

-DMYSQL_MAINTAINER_MODE:BOOL=OFF \

-DWITH_EMBEDDED_SERVER:BOOL=ON \

-DWITH_EXTRA_CHARSETS:STRING=all \

-DWITH_SSL:STRING=bundled \

-DWITH_UNIT_TESTS:BOOL=OFF \

-DWITH_ZLIB:STRING=bundled \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_COMMENT=dancebear \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-LH

shell>make && make install

shell>groupadd mysql

shell>useradd -g mysql mysql

shell>mkdir /usr/local/mysql/conf

shell>mkdir /usr/local/mysql/var

shell>cd /usr/local/mysql

shell>cp support-files/my-huge.cnf conf/my.cnf

shell>chown -R root:mysql /usr/local/mysql

shell>/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --skip-name-resolve--user=mysql --defaults-file=/usr/local/mysql/conf/my.cnf--pid-file=/usr/local/mysql/var/mysql.pid--socket=/usr/local/mysql/var/mysql.sock

shell>ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

shell>ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/

shell>ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/

shell>ln -s /usr/local/mysql/share/mysql/mysql.server/usr/bin/

shell>ln -s /usr/local/mysql/bin/mysqldump /usr/bin/

3 mysql自動啟動腳本

shell>cp /usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld

shell>chmod 755 /etc/init.d/mysqld

shell>chkconfig –-add mysqld

shell>chkconfig –-level 345 mysqld on

修改配置文件/etc/init.d/mysqld,添加安裝mysql的路徑

basedir=/usr/local/mysql

datadir=/usr/local/mysql/data

可以使用以下命令啟停mysql服務或查看當前mysql服務狀態

shell>/etc/init.d/mysqld start

shell>/etc/init.d/mysqld stop

shell>/etc/init.d/mysqld status

4 root密碼

shell>/usr/local/mysql/bin/mysqladmin –u root password‘password’

本欄目更多精彩內容:http://www.bianceng.cn/OS/Linux/

Copyright © Linux教程網 All Rights Reserved