Centos5.5中安裝Mysql5.5過程分享
來源:易賢網(wǎng) 閱讀:960 次 日期:2015-03-10 16:09:25
溫馨提示:易賢網(wǎng)小編為您整理了“Centos5.5中安裝Mysql5.5過程分享”,方便廣大網(wǎng)友查閱!

這幾天在centos下裝mysql,這里記錄一下安裝的過程,方便以后查閱

Mysql5.5.37安裝需要cmake,5.6版本開始都需要cmake來編譯,5.5以后的版本應(yīng)該也要裝這個(gè)。

安裝cmake

代碼如下:

[root@local ~]# wget

[root@local ~]# tar xvf cmake-2.8.12.2.tar.gz

[root@local ~]# cd cmake-2.8.12.2

[root@local cmake-2.8.12.2]#./bootstrap

[root@local cmake-2.8.12.2]# make

[root@local cmake-2.8.12.2]# make install

安裝mysql

代碼如下:

[root@local ~]# wget

[root@local ~]# tar xvf mysql-5.5.37.tar.gz

[root@local ~]# cd mysql-5.5.37

[root@local mysql-5.5.37]# cmake ./

可能還會(huì)報(bào)這個(gè)錯(cuò),沒有就跳過

代碼如下:

CMake Error at cmake/readline.cmake:83(MESSAGE):

Curses library not found. Pleaseinstall appropriate package,

remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name islibncurses5-dev, on Redhat and derivates it is ncurses-devel.

Call Stack (most recent call first):

cmake/readline.cmake:127 (FIND_CURSES)

cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)

CMakeLists.txt:355 (MYSQL_CHECK_READLINE

-- Configuring incomplete, errors occurred!

See also "/root/my/mysql-5.5.37/CMakeFiles/CMakeOutput.log".

See also"/root/my/mysql-5.5.37/CMakeFiles/CMakeError.log".

說明centos系統(tǒng)沒有ncurses-devel

代碼如下:

[root@local ~]# wget

[root@local ~]# cd ncurses-5.9

[root@local ncurses-5.9]#./configure

[root@local ncurses-5.9]# make

[root@local ncurses-5.9]# make install

再刪除剛才編譯生成的 CMakeCache.txt 文件,否則無法進(jìn)行下一步

代碼如下:

[root@local mysql-5.5.37]# rm -f CMakeCache.txt

繼續(xù)編譯mysql

代碼如下:

[root@local ~]# cmake ./

[root@local ~]# make

[root@local ~]# make install

這樣,mysql默認(rèn)將成功安裝到/usr/local/mysql

創(chuàng)建mysql用戶組

代碼如下:

[root@local ~]# groupadd mysql

[root@local ~]# useradd –r –g mysql mysql

[root@local ~]# chown –R mysql.mysql /usr/local/mysql

啟動(dòng)mysql

代碼如下:

[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql

這里可能會(huì)發(fā)生錯(cuò)誤,沒有就跳過:

代碼如下:

FATAL ERROR: Could not find./bin/my_print_defaults

If you compiled from source, you need torun 'make install' to

copy the software into the correct locationready for operation.

If you are using a binary release, you musteither be at the top

level of the extracted archive, or pass the --basedir option

pointing to that location.

解決方法:

代碼如下:

[root@local ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

再啟動(dòng)mysql

代碼如下:

[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql

注冊(cè)mysql服務(wù),開機(jī)自動(dòng)啟動(dòng)

1.設(shè)置mysql配置文件到/etc目錄

代碼如下:

[root@local ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf

2.設(shè)置mysql開機(jī)自啟

代碼如下:

[root@local ~]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

[root@local ~]# chmod +x /etc/init.d/mysql

[root@local ~]# /sbin/chkconfig --add mysql

3.啟動(dòng)mysql服務(wù)

代碼如下:

[root@local ~]# service mysql start

測試mysql是否安裝成功

代碼如下:

[root@local ~]# /usr/local/mysql/bin/mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.37 Source distribution

Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved.

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners.

Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| test |

+--------------------+

4 rows in set (0.03 sec)

更多信息請(qǐng)查看IT技術(shù)專欄

更多信息請(qǐng)查看數(shù)據(jù)庫
易賢網(wǎng)手機(jī)網(wǎng)站地址:Centos5.5中安裝Mysql5.5過程分享
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國考·省考課程試聽報(bào)名

  • 報(bào)班類型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)