Centos5.5中安裝Mysql5.5過程分享
這幾天在centos下裝mysql,這里記錄一下安裝的過程,方便以后查閱
Mysql5.5.37安裝需要cmake,5.6版本開始都需要cmake來編譯,5.5以后的版本應(yīng)該也要裝這個(gè)。
安裝cmake
[root@local ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
[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 http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz
[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 http://invisible-island.net/datafiles/release/ncurses.tar.gz
[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
注冊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)
相關(guān)文章
查看 MySQL 已經(jīng)運(yùn)行多長時(shí)間的方法
查看MySQL啟動(dòng)時(shí)間以及運(yùn)行了多長時(shí)間的方法有利用show與updtime或在linux中直接使用grep mysql 相關(guān)參數(shù)來查看,下面我們一起來看看2014-01-01
MySQL性能優(yōu)化之路---修改配置文件my.cnf
mysql數(shù)據(jù)庫的優(yōu)化,算是一個(gè)老生常談的問題了,網(wǎng)上也有很多關(guān)于各方面性能優(yōu)化的例子,今天我們要談的是MySQL 系統(tǒng)參數(shù)的優(yōu)化即優(yōu)化my.cnf文件2014-06-06
mysql 5.7.17 以及workbench安裝配置圖文教程
這篇文章主要為大家詳細(xì)介紹了mysql 5.7.17 以及workbench安裝配置圖文教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-06-06
Ubuntu 18.04下mysql 8.0 安裝配置方法圖文教程
這篇文章主要為大家詳細(xì)介紹了Ubuntu 18.04下mysql 8.0 安裝配置方法圖文教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-05-05
MySQL定時(shí)器EVENT學(xué)習(xí)筆記
本文為大家介紹下MySQL定時(shí)器EVENT,要使定時(shí)起作用 MySQL的常量GLOBAL event_scheduler必須為on或者是1,感興趣的朋友可以了解下2013-11-11
MySQL for update鎖表還是鎖行校驗(yàn)(過程詳解)
在MySQL中,使用for update子句可以對查詢結(jié)果集進(jìn)行行級鎖定,以便在事務(wù)中對這些行進(jìn)行更新或者防止其他事務(wù)對這些行進(jìn)行修改,這篇文章主要介紹了MySQL for update鎖表還是鎖行校驗(yàn),需要的朋友可以參考下2024-02-02

