Share the Mysql5.5 Installation Process in Centos5.5, centos5.5mysql5.5

Source: Internet
Author: User

Share the Mysql5.5 Installation Process in Centos5.5, centos5.5mysql5.5

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

Copy codeThe Code is as follows:
[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

Install mysql

Copy codeThe Code is as follows:
[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.

Copy codeThe Code is as follows:
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.

Copy codeThe Code is as follows:
[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

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

Copy codeThe Code is as follows:
[Root @ local mysql-5.5.37] # rm-f CMakeCache.txt

Continue mysql Compilation

Copy codeThe Code is as follows:
[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

Copy codeThe Code is as follows:
[Root @ local ~] # Groupadd mysql
[Root @ local ~] # Useradd-r-g mysql
[Root @ local ~] # Chown-R mysql. mysql/usr/local/mysql

Start mysql

Copy codeThe Code is as follows:
[Root @ local ~] #/Usr/local/mysql/bin/mysqld_safe -- user = mysql

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

Copy codeThe Code is as follows:
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:

Copy codeThe Code is as follows:
[Root @ local ~] #/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data

Start mysql again

Copy codeThe Code is as follows:
[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.

Copy codeThe Code is as follows:
[Root @ local ~] # Cp/usr/local/mysql/support-files/my-medium.cnf/etc/my. cnf

2. Set mysql to start automatically

Copy codeThe Code is as follows:
[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

Copy codeThe Code is as follows:
[Root @ local ~] # Service mysql start

Test whether mysql is successfully installed.

Copy codeThe Code is as follows:
[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,201 4, 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)

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.