Install MySQL 5.5.21 in centos 6.1 source code

Source: Internet
Author: User

I searched a lot of documents on the Internet and basically copied them to copy them. I couldn't find an article that could be used at all.

The article was modified on the basis of Teacher Zhu MahaI. It is absolutely usable and has just been installed successfully.

Step 1: first install the required library.

Yum install GCC gcc-C ++
Yum install ncurses-devel

CD/opt/down -- all downloaded files are stored here, so here I go to this directory.

Wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
Wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz

After the download is complete

Install cmake

Tar zxvf cmake-2.8.7.tar.gz
CD cmake-2.8.7
./Bootstrap
Make & make install

Continue to install bison

Tar zxvf bison-2.5.tar.gz
CD bison-2.5
./Configure
Make & make install

Step 2: download and install MySQL

Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mysql.he.net/

After the download is complete

/Usr/sbin/groupadd MySQL
/Usr/sbin/useradd-G MySQL
Tar xvf mysql-5.5.15.tar.gz
CD mysql-5.5.15/-- enter the extract directory
Cmake-dcmake_install_prefix =/usr/local/MySQL \
-Dmysql_unix_addr =/tmp/MySQL. Sock \
-Ddefault_charset = utf8 \
-Ddefault_collation = utf8_general_ci \
-Dwith_extra_charsets = all \
-Dwith_myisam_storage_engine = 1 \
-Dwith_innobase_storage_engine = 1 \
-Dwith_memory_storage_engine = 1 \
-Dwith_readline = 1 \
-Denabled_local_infile = 1 \
-Dmysql_datadir =/var/MySQL/data \
-Dmysql_user = MySQL

Make & make install

Step 3: Set and initialize

Chmod + w/usr/local/MySQL
Chown-r MYSQL: MySQL/usr/local/MySQL
Ln-S/usr/local/MySQL/lib/libmysqlclient. so.16/usr/lib/libmysqlclient. so.16
Ln-S/var/lib/MySQL. Sock/tmp/MySQL. Sock
Mkdir-P/var/MySQL/
Mkdir-P/var/MySQL/data/
Mkdir-P/var/MySQL/log/
Chown-r MYSQL: MySQL/var/MySQL/
CD support-files/
CP my-large.cnf/var/MySQL/My. CNF
CP mysql. Server/etc/rc. d/init. d/mysqld
/Usr/local/MySQL/scripts/mysql_install_db -- defaults-file =/var/MySQL/My. CNF -- basedir =/usr/local/MySQL -- datadir =/var/MySQL/data -- user = MySQL
Chmod + x/etc/init. d/mysqld

VI/etc/init. d/mysqld (edit this file, find and modify the following variable content :)
Basedir =/usr/local/MySQL
Datadir =/var/MySQL/Data

Add to service and start MySQL

Chkconfig -- add mysqld

Service mysqld start service (restart the system as well)

/Usr/local/MySQL/bin/mysqladmin password [New-Password] (Change Password)

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.