Compile and install MySQL

Source: Internet
Author: User

First, MySQL Introduction

MySQL is an open source small relational database management system, developer for Sweden MySQL AB, after the acquisition of the MySQL Ab,orance Company acquired Sum, so the current MySQL project by Orance Company is responsible for the operation and maintenance. MySQL is widely used in small and medium-sized websites on the internet. Because of its small size, fast speed, low total cost of ownership, especially the open source, many small and medium-sized web sites in order to reduce the total cost of ownership of the site chose MySQL as the site database.

Second, the source code compilation and installation

(1) Create a running user

[[email protected] ~]# useradd-m-u 50-s/sbin/nologin mysql


(2) Unpacking

Official Download site http://www.mysql.com

The mysql-5.1.55 version I'm using here

[Email protected] ~]# tar XF mysql-5.1.55.tar.gz-c/usr/src/

[Email protected] ~]# cd/usr/src/mysql-5.1.55/

[Email protected] mysql-5.1.55]#


(3) configuration

[Email protected] mysql-5.1.55]#/configure--prefix=/usr/local/mysql--with-charset=utf8--with-collation=utf8_ General_ci--with-extra-charsets=gbk,gb2312

Meaning of each option in the above configuration

>--prefix: Install the specified MySQL database program to which directory, such as/usr/local/mysql

>--with-charset: Specifies the character set encoding that is used by default and should correspond to the school team rules, such as UTF8

>--with-collation: Specifies the default character set to use for the school team rules

>--with-extra-charsets: Specify additional support for other character set encodings, such as gbk,gb232, etc.


Note: To make some small adjustments, you can get full support after compiling, such as modifying the Config.h file under the include sub-file, adding the corresponding compilation definition (by default, if no add is present)

[Email protected] mysql-5.1.55]# vim include/config.h

#define HAVE_CHARSET_GBK 1

#define HAVE_CHARSET_GB2312 1


(4) Compile and install

[[email protected] mysql-5.1.55]# make && make install


Third, other adjustments

(1) Setting up the configuration file

[email protected] mysql-5.1.55]# CP support-files/my-medium.cnf/etc/my.cnf


(2) Initializing the database

[Email protected] mysql-5.1.55]# cd/usr/local/mysql/bin/

[Email protected] bin]#/mysql_install_db--user=mysql [--datadir=/mydata/data]

[Email protected] bin]# chown-r root:mysql/usr/local/mysql/

[Email protected] bin]# chown-r mysql/usr/local/mysql/var/


(3) Optimize execution path, library path

[Email protected] bin]# ln-s/usr/local/mysql/bin/*/usr/local/bin/

[Email protected] bin]# ln-s/usr/local/mysql/lib/mysql/*/usr/lib/

[Email protected] bin]# ln-s/usr/local/mysql/include/mysql/*/usr/include/


(4) Adding system services

[Email protected] bin]# cd/usr/src/mysql-5.1.55/

[[email protected] mysql-5.1.55]# CP Support-files/mysql.server/etc/init.d/mysqld[[email protected] mysql-5.1.55]# chmod +x/etc/init.d/mysqld

[Email protected] mysql-5.1.55]# chkconfig--add mysqld

[[email protected] mysql-5.1.55]#/etc/init.d/mysqld start

[Email protected] mysql-5.1.55]#/etc/init.d/mysqld status


(5) Start MySQL, success

[Email protected] ~]# service mysqld restart

Shutting down MySQL. Determine

Starting MySQL. Determine


(6) Initial setup password

[Email protected] ~]# mysqladmin-u root password 123456


(7) Enter MySQL database

[Email protected] ~]# mysql-u root-p123456

Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 3

Server Version:5.1.55-log Source Distribution

Copyright (c), Oracle and/or its affiliates. All rights reserved.

This software comes with absolutely NO WARRANTY. This is the free software,

And you is welcome to modify and redistribute it under the GPL v2 licensetype ' help; ' or ' \h ' for help.

Type ' \c ' to clear the current input statement.

Mysql>


Now that the MySQL build is complete, the MySQL statement will be introduced next.

This article from "Konghuai Sense" blog, reproduced please contact the author!

Compile and install MySQL

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.