MySQL 5.6 compilation

Source: Internet
Author: User

See Daniel's learning methods, today caught dead, because has been concerned about operation and maintenance. Everyone says, LAMP. Lnamp environment can learn a lot of things. In fact, it is true that httpd can learn to optimize, load, and recognize the architecture of the Web environment.

Through some other people's posts. Summarize the next MySQL installation, the whole process of sharing is their own archive summary, hope in 51CTO out a good start.


We all know that MySQL installation depends on the package ncurses GCC, and there is a need for the compilation tool, because the version of 5.5 with CMake as a compilation tool.

First of all, many people ask why the installation of MySQL to create a MySQL user, this is the equivalent of a voucher it. There is a lot of security functions, such as hackers black you, can get MySQL, but do not see root, this should be the greatest protection.

Let's go!

Yum Install ncurses-devel gcc gcc-c++ cmake

MySQL self-download

Groupadd MySQL create MySQL group

Useradd-g MySQL mysql/sbin/nologin/-M creates a MySQL user to join to the group and does not let him log in.

Verify:

cat/etc/passwd

Cat/etc/group

Mkdir-p/usr/local/mysql5.6/mysql/data Create library directory, installation directory, data storage directory.

Chown-r mysql:mysql/usr/local/mysql5.6/mysql mysql data with permissions assigned to it

Chown-r Mysql:mysql/usr/local/mysql/5.6/data

Compile:


CMake \

-dcmake_install_prefix=/usr/local/mysql5.6 \ Defining the installation path

-dmysql_datadir=/usr/local/mysql5.6/data \ Define Database path

-dmysql_unix_addr=/usr/local/mysql5.6/mysql.sock \ Definition Monitoring

-ddefault_charset=utf8 \ Defining characters

-DDEFAULT_COLLATION=UTF8_GENERAL_CI \ Check Character

-dwith_innobase_storage_engine=1 \ The following 4 engines are installed, there are different functions of the database

-dwith_archive_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dwith_memory_storage_engine=1 \

-dmysql_user=mysql \ Specify user

-dmysql_tcp_port=3306 Specifying ports

-dwith_debug=0 \ Close DEBUG


Make &&make Install


This process is still a little bit long, patience and so on ~~~~~~~~~~~~~~~~~~~~~


For MySQL to do a startup script package, is actually CP, haha

Take my path as an example:


Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld

chmod +x/etc/init.d/mysqld Giving Execute permission

Chkconfig--level mysqld on turn on start list level 35

The following initializes the database:

/usr/loca/mysql/scripts/mysql_install_db--user=mysql \

--basedir=/usr/local/mysql5.6/--datadir=/usr/local.mysql5.6/data

You can see the files generated under the data directory


Copy the MySQL configuration file to the appropriate directory

Cp/usr/loca/mysql5.6/support-files/mysql-default-cnf/etc/init.d/my.cnf


Vim/etc/init.d/my.cnf


port=3306

Basedir=/usr/local/mysql

Datadir=/usr/local/mysql/data

socket=/usr/local/mysql/mysqld.sock


Log-error=/var/log/mysqld.log

Pid-file=/usr/local/mysql/data/mysqlservera.pid

Modify parameter to above


And finally the environment variable.

echo "Export path=/usr/loca/mysql5.6/bin: $PATH" >>/etc/export

Service mysqld Restart

View Monitoring

NETSTAT-TULNP |grep 3306

View process

Ps-ef |grep mysqld

End MYSQL Direct login, on password ok!




MySQL 5.6 compilation

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.