Centos5.5中安裝Mysql5.5過程分享
這幾天在centos下裝mysql,這裡記錄一下安裝的過程,方便以後查閱
Mysql5.5.37安裝需要cmake,5.6版本開始都需要cmake來編譯,5.5以後的版本應該也要裝這個。
安裝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 ./
可能還會報這個錯,沒有就跳過
複製程式碼 程式碼如下:
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系統沒有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 檔案,否則無法進行下一步
複製程式碼 程式碼如下:
[root@local mysql-5.5.37]# rm -f CMakeCache.txt
繼續編譯mysql
複製程式碼 程式碼如下:
[root@local ~]# cmake ./
[root@local ~]# make
[root@local ~]# make install
這樣,mysql預設將成功安裝到/usr/local/mysql
建立mysql使用者組
複製程式碼 程式碼如下:
[root@local ~]# groupadd mysql
[root@local ~]# useradd –r –g mysql mysql
[root@local ~]# chown –R mysql.mysql /usr/local/mysql
啟動mysql
複製程式碼 程式碼如下:
[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
這裡可能會發生錯誤,沒有就跳過:
複製程式碼 程式碼如下:
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
再啟動mysql
複製程式碼 程式碼如下:
[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
註冊mysql服務,開機自動啟動
1.設定mysql配置檔案到/etc目錄
複製程式碼 程式碼如下:
[root@local ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf
2.設定mysql開機自啟
複製程式碼 程式碼如下:
[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.啟動mysql服務
複製程式碼 程式碼如下:
[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)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2035/viewspace-2810667/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Python 3安裝IPython過程分享Python
- selenium安裝過程
- 安裝yeoman,grunt過程中的問題
- webpack的安裝過程Web
- 【一】TYPORA安裝過程
- 安裝wampserver的過程Server
- postgresql安裝過程中核心資源的配置SQL
- MySql安裝過程中初始化失敗MySql
- pycharm中安裝和使用sqlite過程詳解PyCharmSQLite
- 關於ubuntu安裝中過程遇到問題Ubuntu
- CentOS安裝MySQL5.5的完整步驟DSITCentOSMySql
- Tigase手動安裝過程
- RabbitMQ安裝過程詳解MQ
- 原始碼包安裝過程原始碼
- windows7安裝redis過程WindowsRedis
- VisualStudio(Mac)安裝過程筆記Mac筆記
- Win10安裝Mysql5.5卡住假死怎麼回事 win10系統安裝Mysql5.5卡死未響應如何解決Win10MySql
- 安裝gcc過程中遇到相互依賴的問題GC
- win10的pycharm中安裝ansible模組過程Win10PyCharm
- Oracle 18c rpm 安裝及解析安裝過程Oracle
- Visual Studio 2010詳細安裝過程
- mysql5.7.23安裝詳細過程MySql
- 使用pip安裝selenium過程筆記筆記
- Ubuntu 16.04 安裝 MySQL 8.0 全過程UbuntuMySql
- nuxtjs 安裝過程中出現問題UXJS
- CentOS7下PostgreSQL安裝過程CentOSSQL
- 秒搞VirtualBox 、CentOS 的安裝過程CentOS
- android apk安裝過程原始碼解析AndroidAPK原始碼
- redhat 5.4下安裝MYSQL全過程RedhatMySql
- ubuntu 12.10 php55安裝過程UbuntuPHP
- 整理debian安裝過程中的一些問題與方法
- 蘋果簽名過程中App安裝出錯怎麼辦?蘋果APP
- PYTORCH安裝過程以及遇到的問題PyTorch
- Webpack安裝配置及打包詳細過程Web
- 記錄NLTK安裝使用全過程--pythonPython
- ESXI 6.7 系統安裝詳細過程
- Nebula 2.5.0安裝過程及遇到的坑
- WSL 2 的安裝過程(以及介紹)