Compile and install mySQL5 in CentOS 6

Source: Internet
Author: User

I. Preparations
1. Install and install CentOS6 quickly.
2. Install the library file required for mysql compilation. In this case, you can choose to use the CD yum.
[Root @ admin share] # cd/media/
[Root @ admin media] # mkdir CentOS
[Root @ admin media] # mount/dev/cdrom/media/CentOS
[Root @ admin media] # cd/etc/yum. repos. d/
[Root @ admin yum. repos. d] # Music CentOS-Base.repo CentOS-Base.repo.bak
[Root @ admin yum. repos. d] # Music CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak
So far, yum made of CD is available;
[Root @ admin ~] # Yum -- enablerepo = c6-media install ncurses * gcc * perl *-y
3, prepare the installation package. (here in the mysql-5.0.56.tar.gz example)
4. Add a mysql user
[Root @ admin ~] # Groupadd mysql
[Root @ admin ~] # Useradd-g mysql-s/bin/nologin
 
Ii. Formal Installation
1. [root @ admin software] # tar zxvf mysql-5.0.56.tar.gz
2. [root @ admin software] # cd mysql-5.0.56
3. [root @ administrator mysql-5.0.56] #. /configure -- prefix =/usr/local/mysql -- localstatedir =/data/mysql -- enable-consumer er -- enable-static -- with-mysqld-user = mysql -- with-big-tables -- enable-thread-safe-client -- enable-local-infile -- with-charset-utf8 -- with-extra-charsets = all
4. [root @ admin mysql-5.0.56] # make & make install
5. [root @ admin mysql-5.0.56] # cp support-files/my-medium.cnf/etc/my. cnf
6. [root @ adim share] # cd/usr/local/mysql/
7. [root @ admin mysql] # bin/mysql_install_db -- user = mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
 
To start mysqld at boot time you have to copy
Support-files/mysql. server to the right place for your system
 
Please remember to set a password for the MySQL root USER!
To do so, start the server, then issue the following commands:
/Usr/local/mysql/bin/mysqladmin-u root password 'new-password'
/Usr/local/mysql/bin/mysqladmin-u root-h localhost. localdomain password 'new-password'
 
Alternatively you can run:
/Usr/local/mysql/bin/mysql_secure_installation
 
Which will also give you the option of removing the test
Databases and anonymous user created by default. This is
Stronugly recommended for production servers.
 
See the manual for more instructions.
 
You can start the MySQL daemon:
Cd/usr/local/mysql;/usr/local/mysql/bin/mysqld_safe &
 
You can test the MySQL daemon with mysql-test-run.pl
Cd mysql-test; perl mysql-test-run.pl
 
Please report any problems with the/usr/local/mysql/bin/mysqlbug script!
 
The latest information about MySQL is available on the web
Http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
 
 
8. [root @ admin mysql] # chown-R mysql. mysql/data/mysql/
9. [root @ admin mysql] # share/mysql. server start
Starting MySQL SUCCESS! # --------------> The installation is successful.
10. [root @ admin mysql] # netstat-tunlp | grep mysql
Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN 13193/mysqld

 

Iii. Post-thread work
1. [root @ admin ~] # Ln-s/usr/local/mysql/share/mysql. server/etc/init. d/mysqld
2. [root @ admin ~] # Ln-s/usr/local/mysql/bin/mysql/usr/sbin/mysql
3. [root @ admin ~] # Ln-s/usr/local/mysql/bin/mysqladmin/usr/sbin/mysqladmin
4. [root @ admin ~] # Ln-s/usr/local/mysql/bin/mysqldump/usr/sbin/mysqldump
5. [root @ admin ~] # Mysql-uroot-p
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 2
Server version: 5.0.56-log Source distribution
 
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
 
Mysql>

 

This article is from the "OpenSource drop sky" blog

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.