程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> Centos5.5中裝置Mysql5.5進程分享

Centos5.5中裝置Mysql5.5進程分享

編輯:MySQL綜合教程

Centos5.5中裝置Mysql5.5進程分享。本站提示廣大學習愛好者:(Centos5.5中裝置Mysql5.5進程分享)文章只能為提供參考,不一定能成為您想要的結果。以下是Centos5.5中裝置Mysql5.5進程分享正文


這幾天在centos下裝mysql,這裡記載一下裝置的進程,便利今後查閱

Mysql5.5.37裝置須要cmake,5.6版本開端都須要cmake來編譯,5.5今後的版本應當也要裝這個。

裝置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 ./

能夠還會報這個錯,沒有就跳過


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) 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved