Use cmake in CentOS 5.6 to compile MySQL 5.5.13 source code and installation transcript

Source: Internet
Author: User
Tags automake

Original works can be reprinted. During reprinting, you must mark the original source, author information, and this statement in hyperlink form. Otherwise, legal liability will be held.Http://winos.blog.51cto.com/937089/582997

I. Prepare the environment

1. Install and ensure the following system related library files

Gcc-c ++ autoconf automake zlib * libxml * ncurses-devel libmcrypt * libtool * (libtool-ltdl-devel *)

# Yum-y install gcc-c ++ autoconf automake zlib * libxml * ncurses-devel libmcrypt * libtool *

2. Create the mysql installation directory and data storage directory

# Mkdir/usr/local/mysql

# Mkdir/var/mysqldata


3. Create users and user groups

# Groupadd mysql

# Useradd-g mysql


4. Grant the data directory storage permission

# Chown mysql. mysql-R/var/mysqldata/


5. Install cmake

Mysql5.5 and later are compiled using cmake.

Download cmake-2.8.4.tar.gz from the http://www.cmake.org web site.

# Wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

# Tar zxvf cmake-2.8.4.tar.gz

# Cd cmake-2.8.4

#./Configure

# Make & make install


 

Ii. Install MySQL 5.5.13

1. Obtain and decompress mysql-5.5.13.tar.gz.

Download mysql-5.5.13.tar.gz at http://www.mysql.com/downloads/mysql

# Wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.13.tar.gz

# Tar zxvf mysql-5.5.13.tar.gz

# Cd mysql-5.5.13


2. Compile mysql-5.5.13

# Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \

-DMYSQL_UNIX_ADDR =/var/mysqldata/mysql. sock \

-DDEFAULT_CHARSET = utf8 \

-DDEFAULT_COLLATION = utf8_general_ci \

-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk \

-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/mysqldata \

-DMYSQL_USER = mysql \

-DMYSQL_TCP_PORT = 3306

# Make

# Make install


3. Copy the configuration file

# Cp support-files/my-medium.cnf/etc/my. cnf


4. initialize the database

Grant the execution permission to the scripts/mysql_install_db file before execution.

# Chmod 755 scripts/mysql_install_db

# Scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql /\

-- Datadir =/var/mysqldata/

Note: basedir: mysql installation path datadir: database file storage path


5. Set mysqld startup

# Cp support-files/mysql. server/etc/init. d/mysql

# Chmod 755/etc/init. d/mysql

# Chkconfig mysql on


6. Configure environment variables for MySQL

Adding the bin directory of mysql to the PATH facilitates future management and maintenance. Adding myslq/bin to/etc/profile also adds two aliases for easy operation:

# Export PATH =/usr/local/mysql/bin: $ PATH

# Alias mysql_start = "mysqld_safe &"

# Alias mysql_stop = "mysqladmin-u root-p shutdown"


7. Start the mysql Service

#/Etc/init. d/mysql start

Run the ps-ef | grep mysql command to check whether the mysql instance is started.


8. log on to mysql

# Mysql-u root-p

 


Iii. MySQL Standard settings

1. Set the initial password for the root account

#/Usr/local/mysql/bin/mysqladmin-u root password 'new-password'

Or you can only log on through the local machine.

#/Usr/local/mysql/bin/mysqladmin-u root-h 'hostname' password 'new-password'

2. delete an empty password account for anonymous connection to the Local Machine

Log on to mysql

Mysql> use mysql; // select the default database mysql

Mysql> update user set password = 'root123' where user = '2017. 0.0.1 ';

Mysql> delete from user where password = ""; // the root password cannot be blank.

Mysql> flush privileges;

Mysql> quit


Allow the root user to log on remotely

For the root account, if you consider security, you should create another account for remote logon. the root account does not have to enable remote logon. However, for general use, there are not many security requirements, allowing the root user to log on remotely for convenient management. After all, it is much easier to use the graphical interface of the dedicated management software for operations.

 

3. Set MySQL remote connection

1) mysql database settings

#/Mysql-u root-p // enter the database

Mysql> use mysql

Mysql> select user, password, host from user;

Mysql> update user set host = '192. 192.% 'where user = '192. 0.0.1 ';

Mysql> grant all privileges on *. * to root @ '%' identified by "root123"; // grant permissions to the remote connection logged on by root @ ip to connect to the database. Common Causes of remote connection failure. Set the password of the remote logon user to root.

Mysql> flush privileges;

Mysql> quit


2) MySQL client in Windows

MySQL official GUI client: http://www.mysql.com/downloads/workbench/

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.