Compiling and installing MySQL 5.5

Source: Internet
Author: User

1 MySQL 5.5.11 compilation installation
1.1 System library related library files required for installation
GCC gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*

1.2 Creating the MySQL installation directory
[Email protected] mysql-5.5.11]# mkdir-p/usr/local/mysql/

1.3 Creating a data store directory
[Email protected] mysql-5.5.11]# mkdir-p/data/mysql/

1.4 Create user and user groups with permissions to assign data to directory
[[email protected] mysql-5.5.11]# Groupadd MySQL

[[email protected] mysql-5.5.11]# useradd-g MySQL MySQL

[Email protected] mysql-5.5.11]# chown mysql.mysql-r/data/mysql/

1.5 Installing CMake
(mysql5.5 is compiled by CMake later)

Download Unzip cmake-2.8.4.tar.gz

[Email protected] mysql-5.5.11]# wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

Files in//192.168.10.250/cgroup/soft/mysql

[Email protected] mysql-5.5.11]# tar zxvf cmake-2.8.4.tar.gz

[Email protected] mysql-5.5.11]# CD cmake-2.8.4

[Email protected] Mysql-5.5.11]#./configure

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

1.6 Installing MySQL 5.5.11
[[email protected] mysql-5.5.11] #wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.11.tar.gz

Files in//192.168.10.250/cgroup/soft/mysql

[Email protected] down]# tar zxvf mysql-5.5.11.tar.gz

[Email protected] down]# CD mysql-5.5.11

1.7 Compiling mysql-5.5.11
[[email protected] mysql-5.5.11] #cmake-dcmake_install_prefix=/usr/local/mysql \

-dmysql_unix_addr=/data/mysql/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=/data/mysql \

-dmysql_user=mysql \

-dmysql_tcp_port=3306

The above command is copied into the command line at once.

[[email protected] mysql-5.5.11]# make

[[email protected] mysql-5.5.11]# make install

1.8 Copying a configuration file
[Email protected]]# CP support-files/my-medium.cnf/etc/my.cnf

1.9 Initializing the database
(Requires chmod 755 scripts/mysql_install_db assignment to file execution rights before execution)

[[email protected] mysql-5.5.11] #scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/data/ mysql/

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

1.10 Setting the Mysqld boot:
[Email protected]]# CP Support-files/mysql.server/etc/init.d/mysql

[Email protected]]# chmod 755/etc/init.d/mysql

Chkconfig MySQL on

1.11 Configuring the Environment
For convenience, add MySQL Bin directory to path, add Myslq/bin to/etc/profile, and add two aliases to facilitate operation:

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

Switch client

Alias mysql_start= "mysqld_safe&"

Alias mysql_stop= "Mysqladmin-uroot-p shutdown"

1.12 Starting the MySQL service
[[email protected] mysql-5.5.11]#/etc/init.d/mysql start//server-side switch

After startup, use the Ps-ef |grep mysql command to see if it starts

[[email protected] mysql-5.5.11]#/mysql–u root–p//client Switch Reference 1.11 article

2 Standard MySQL installation settings

2.1 Setting the password for the root account
[[email protected] mysql-5.5.11] #mysqladmin-u root password ' yourpassword '

2.2 Delete the empty password account for the native anonymous connection
Native login MySQL

[[email protected] mysql-5.5.11] #mysql –u root-p
Then enter the password set above and execute it on the MySQL command line after logging in:

Mysql>use MySQL; Select default Database MySQL

Mysql>update user set password= ' root ' where user = ' 127.0.0.1 ';

Mysql>delete from user where password= "";//The root password is not allowed to be empty

Mysql>flush privileges;

Mysql>quit

Allow the root user to Telnet

For root account, if you consider security should create a new account for remote login, root account can not have to open remote login. However, for general use, there is not much security requirements, allowing root users to Telnet can be easily managed, after all, the use of special management software graphical interface in the operation of more convenient.

  

3 implementation of MySQL remote connection actual operation process

3.1 MySQL database-side settings
[[email protected] mysql-5.5.11]#/mysql–u root–p//Enter the database

Mysql>use MySQL

Mysql>select user,password,host from user;

Mysql>update User Set host = ' 192.168.% ' where user = ' 127.0.0.1 ';

Mysql>grant all privileges on * * to [e-mail protected] '% ' identified by ' root ';//give permission to the remote connection [email protected] Login to connect the data Library. Causes of common problems that cannot be connected remotely.

and set the Telnet user's password to root

mysql> flush Privileges;

Mysql>quit


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.