Centos5.5 install Mysql5.5

Source: Internet
Author: User
In the past few days, I have downloaded mysql in centos. here I will record the installation process. For more information, see mysql 5.5.37 installation requires cmake, 5.6.

Install mysql in centos these days. record the installation process for future reference.

Cmake is required for Mysql5.5.37 installation, and cmake is required for MySQL 5.6 and later versions.

Install cmake

[Plain] view plaincopyprint? 01. [root @ local ~] # Wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
02. [root @ local ~] # Tar xvf cmake-2.8.12.2.tar.gz
03. [root @ local ~] # Cd cmake-2.8.12.2
04. [root @ local cmake-2.8.12.2] #./bootstrap
05. [root @ local cmake-2.8.12.2] # make
06. [root @ local cmake-2.8.12.2] # make install
[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

[Plain] view plaincopyprint? 01. [root @ local ~] # Wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz
02. [root @ local ~] # Tar xvf mysql-5.5.37.tar.gz
03. [root @ local ~] # Cd mysql-5.5.37
04. [root @ local mysql-5.5.37] # cmake ./
[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 ./

This error may be reported and skipped if no error is reported.

[Plain] view plaincopyprint? 01. CMake Error at cmake/readline. cmake: 83 (MESSAGE ):
02. Curses library not found. Pleaseinstall appropriate package,
03. remove CMakeCache.txt and rerun cmake. On Debian/Ubuntu, package name islibncurses5-dev, on Redhat and derivates it is ncurses-devel.
04. Call Stack (most recent call first ):
05. cmake/readline. cmake: 127 (FIND_CURSES)
06. cmake/readline. cmake: 217 (MYSQL_USE_BUNDLED_LIBEDIT)
07. CMakeLists.txt: 355 (MYSQL_CHECK_READLINE
08. -- checking ing incomplete, errors occurred!
09. See also "/root/my/mysql-5.5.37/CMakeFiles/CMakeOutput. log ".
10. See also "/root/my/mysql-5.5.37/CMakeFiles/CMakeError. log ".
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
-- Refreshing 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 ".

The centos system does not have ncurses-devel.

[Plain] view plaincopyprint? 01. [root @ local ~] # Wgethttp: // invisible-island.net/datafiles/release/ncurses.tar.gz
02. [root @ local ~] # Cd ncurses-5.9
03. [root @ local ncurses-5.9] #./configure
04. [root @ local ncurses-5.9] # make
05. [root @ local ncurses-5.9] # make install
[Root @ local ~] # Wgethttp: // 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

Delete the CMakeCache.txt file generated in the previous compilation. Otherwise, you cannot proceed to the next step.

[Plain] view plaincopyprint? 01. [root @ local mysql-5.5.37] # rm-f CMakeCache.txt
[Root @ local mysql-5.5.37] # rm-f CMakeCache.txt

Continue mysql compilation

[Plain] view plaincopyprint? 01. [root @ local ~] # Cmake ./
02. [root @ local ~] # Make
03. [root @ local ~] # Make install
[Root @ local ~] # Cmake ./
[Root @ local ~] # Make
[Root @ local ~] # Make install

By default, mysql is successfully installed in/usr/local/mysql.

Create a mysql User Group

[Plain] view plaincopyprint? 01. [root @ local ~] # Groupadd mysql
02. [root @ local ~] # Useradd-r-g mysql
03. [root @ local ~] # Chown-R mysql. mysql/usr/local/mysql
[Root @ local ~] # Groupadd mysql
[Root @ local ~] # Useradd-r-g mysql
[Root @ local ~] # Chown-R mysql. mysql/usr/local/mysql

Start mysql

[Plain] view plaincopyprint? 01. [root @ local ~] #/Usr/local/mysql/bin/mysqld_safe -- user = mysql
[Root @ local ~] #/Usr/local/mysql/bin/mysqld_safe -- user = mysql

An error may occur here. skip this step if no error occurs:

[Plain] view plaincopyprint? 01. fatal error: cocould not find./bin/my_print_defaults
02. If you compiled from source, you need torun 'make install'
03. copy the software into the correct locationready for operation.
04. If you are using a binary release, you musteither be at the top
05. level of the extracted archive, or pass the -- basedir option
06. pointing to that location.
Fatal error: cocould not find./bin/my_print_defaults
If you compiled from source, you need torun 'make install'
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.

Solution:

[Plain] view plaincopyprint? 01. [root @ local ~] #/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data
[Root @ local ~] #/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data

Start mysql again

[Plain] view plaincopyprint? 01. [root @ local ~] #/Usr/local/mysql/bin/mysqld_safe -- user = mysql
[Root @ local ~] #/Usr/local/mysql/bin/mysqld_safe -- user = mysql

Register the mysql service and start it automatically upon startup

1. set the mysql configuration file to the/etc directory.

[Plain] view plaincopyprint? 01. [root @ local ~] # Cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf
[Root @ local ~] # Cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf

2. set mysql to start automatically

[Plain] view plaincopyprint? 01. [root @ local ~] # Cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysql
02. [root @ local ~] # Chmod + x/etc/init. d/mysql
03. [root @ local ~] #/Sbin/chkconfig -- add 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. start the mysql service


[Plain] view plaincopyprint? 01. [root @ local ~] # Service mysql start
[Root @ local ~] # Service mysql start
 
Test whether mysql is successfully installed.

[Plain] view plaincopyprint? 01. [root @ local ~] #/Usr/local/mysql/bin/mysql-u root-p
02. Enter password:
03. Welcome to the MySQL monitor. Commands end with; or \ g.
04. Your MySQL connection id is 1
05. Server version: 5.5.37 Source distribution
06.
07. Copyright (c) 2000,201 4, Oracle and/or itsaffiliates. All rights reserved.
08.
09. Oracle is a registered trademark of OracleCorporation and/or its
10. affiliates. Other names may be trademarksof their respective
11. owners.
12.
13. Type 'help; 'or' \ H' for help. type' \ c' toclear the current input statement.
14.
15. mysql> show databases;
16. + -------------------- +
17. | Database |
18. + -------------------- +
19. | information_schema |
20. | mysql |
21. | performance_schema |
22. | test |
23. + -------------------- +
24.4 rows in set (0.03 sec)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.