How to install MySQL5.5 in CentOS5.5 _ MySQL-mysql tutorial

Source: Internet
Author: User
CentOS 5.5

BitsCN.com

There are a lot of Installation notes on the network, but they are not detailed, or the compilation environment is slightly different, the process will be different, so I summed up the existing experience and the experience of my own installation process, the entire process is expanded and detailed. I chose to install MySQL 5.5.27. Here are my installation notes.

Open Terminal

Switch to the root directory

[shell@localhost ~]# su -

Before installing Mysql5.5, uninstall Mysql5.0 that comes with CentOS.

[root@localhost ~]# yum remove mysql

Install cmake

Download the cmakesource code package cmake-2.8.5.tar.gz

[root@localhost ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
Compile and install
[root@localhost]# tar xzvf cmake-2.8.5.tar.gz  
[root@localhost]# cd cmake-2.8.5 
[root@localhost cmake-2.8.5]# ./bootstrap  
 
Error when bootstrapping CMake: Cannot find appropriate C compiler on this system. Please specify one using environment variable CC. See cmake_bootstrap.log for compilers attempted. 
 

Error: The C compiler is missing.

Solution: install the gcc compiler.

It can be installed from the installation disk of the Linux system, or simply by using yum

[root@localhost ~]# yum install gcc

Continue cmake installation

[root@localhost cmake-2.8.5]# ./bootstrap  
Error when bootstrapping CMake: Cannot find appropriate C++ compiler on this system. Please specify one using environment variable CXX. See cmake_bootstrap.log for compilers attempted.
 

Another error is reported: The C ++ compiler is missing.

Install the gcc-c ++ compiler

It can also be installed from the installation disk of the Linux system, or simply by using yum

[root@localhost ~]# yum install gcc-c++

Repeat the preceding operations

[root@localhost cmake-2.8.5]# ./bootstrap 

After no error is reported, compile and install

[root@localhost cmake-2.8.5]# make 
[root@localhost cmake-2.8.5]# make install
[root@localhost cmake-2.8.5]# cmake -version

Start to officially install Mysql

Add mysql users and user groups

[root@localhost ~]# groupadd mysql 
[root@localhost ~]# useradd -g mysql mysql

Download the MySQL source code package mysql-5.5.27.tar.gz

[root@localhost ~]# wget http://dev.mysql.com/Downloads/MySQL-5.5/mysql-5.5.27.tar.gz

Extract

[root@localhost ~]# cd /usr/local/
[root@localhost local]# tar xzvf mysql-5.5.27.tar.gz
[root@localhost local]# cd mysql-5.5.27

Run cmake

[root@localhost mysql-5.5.27]# cmake .

Error:

-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)  CMake Error at cmake/readline.cmake:82 (MESSAGE):   Curses library not found.  Please install appropriate package,        remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first):   cmake/readline.cmake:126 (FIND_CURSES)   cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)   CMakeLists.txt:250 (MYSQL_CHECK_READLINE)  -- Configuring incomplete, errors occurred!

Solution:

[root@localhost mysql-5.5.27]# rm CMakeCache.txt 
[root@localhost mysql-5.5.27]# yum -y install ncurses-devel*

Run cmake again

[root@localhost mysql-5.5.27]# cmake .

There is still a warning.

Warning: Bison executable not found in PATH

There is a warning and it is also solved. if there is a lack of Bison, install it.

[root@localhost mysql-5.5.27]# yum install bison

Run again, no error reported

[root@localhost mysql-5.5.27]# cmake .

You can set the installation configuration options before compilation and installation.

[root@localhost mysql-5.5.27]# ./configure --help

Select the option you want to set based on the help information. you can skip this step and follow the default settings.

# Start compilation and installation. The time is a little longer...

[root@localhost mysql-5.5.27]# make && make install

Complete compilation and installation

Go to the installation directory, change the binary ownership of the program to root, change the ownership of the data directory to mysql User, and update the authorization table.

[root@localhost mysql-5.5.27]# cd /usr/local/mysql
[root@localhost mysql]# chown -R root . 
[root@localhost mysql]# chown -R mysql . 
[root@localhost mysql]# chgrp -R mysql . 
[root@localhost mysql]# scripts/mysql_install_db --user=mysql
 
Initialize database
[root@localhost mysql]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
 

Start mysql safely

[root@localhost mysql]# ./bin/mysqld_safe --user=mysql

Disable mysql

[root@localhost mysql]# ./bin/mysqladmin -u root shutdown -p
The default password is null.
Easy to call, set a soft link for mysql
[root@localhost ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

Other settings:

Set the option file and copy the configuration file to/etc.

[root@localhost mysql]# cp support-files/my-medium.cnf /etc/mysql.cnf
 
Set auto-start
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql 
[root@localhost mysql]# chmod +x /etc/init.d/mysql 
[root@localhost mysql]# chkconfig –add mysqld
[root@localhost mysql]# chkconfg mysqld on

Now you can start and close the Mysql server through the service.

[root@localhost ~]# service mysql start 
[root@localhost ~]# service mysql shutdown

Connect to the server

[root@localhost ~]# ./mysql -u root -p yourpassword
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 3 to server version: 5.5.27 Source distributino
Type 'help;' or '/h' for help. Type '/c' to clear the buffer.
mysql> ...

Mysql> the prompt tells you that mysql is ready to enter the command for you.

MySQL has been properly installed and can be used

Reference URL:

Http://xtony.blog.51cto.com/3964396/836793

Http://blog.163.com/longsu2010@yeah/blog/static/1736123482011416102835660/

BitsCN.com

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.