Install MySQL5.5.11 in Linux (complete installation tutorial)

Source: Internet
Author: User
Tags localhost mysql mysql gui
The latest MySQL version 5.5.11 requires cmake compilation and installation. It is estimated that this method will be used in later versions. I found some installation methods on the Internet and found some installation methods wrong.

The latest MySQL version 5.5.11 requires cmake compilation and installation. It is estimated that this method will be used in later versions. I found some installation methods on the Internet and found some installation methods wrong.

The latest MySQL version 5.5.11 requires cmake compilation and installation. It is estimated that this method will be used in later versions. Some installation methods are found on the internet and some are incorrect, record the installation steps and procedures for your reference!

1 mysql 5.5.11 compilation and Installation
1.1 install the required system library files
Gcc-c ++ gcc-g77 autoconf automake zlib * fiex * libxml * ncurses-devel libmcrypt * libtool-ltdl-devel *

1.2 create a mysql installation directory
[Root @ localhost mysql-5.5.11] # mkdir-p/usr/local/mysql/

1.3 create a data storage directory
[Root @ localhost mysql-5.5.11] # mkdir-p/data/mysql/

1.4 create users and user groups and grant data storage directory permissions
[Root @ localhost mysql-5.5.11] # groupadd mysql

[Root @ localhost mysql-5.5.11] # useradd-g mysql

[Root @ localhost mysql-5.5.11] # chown mysql. mysql-R/data/mysql/

1.5 install cmake
(Mysql5.5 and later are compiled using cmake)

Download and decompress cmake-2.8.4.tar.gz

[Root @ localhost mysql-5.5.11] # wget

// File at // 192.168.10.250/cgroup/soft/mysql

[Root @ localhost mysql-5.5.11] # tar zxvf cmake-2.8.4.tar.gz

[Root @ localhost mysql-5.5.11] # cd cmake-2.8.4

[Root @ localhost mysql-5.5.11] #./configure

[Root @ localhost mysql-5.5.11] # make & make install

1.6 install mysql 5.5.11
[Root @ localhost mysql-5.5.11] # wget

// File at // 192.168.10.250/cgroup/soft/mysql

[Root @ localhost down] # tar zxvf mysql-5.5.11.tar.gz

[Root @ localhost down] # cd mysql-5.5.11

1.7 compile mysql-5.5.11
[Root @ localhost mysql-5.5.11] # cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \

-DMYSQL_UNIX_ADDR =/data/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

Copy the preceding command to the command line at a time.

[Root @ host mysql-5.5.11] # make

[Root @ host mysql-5.5.11] # make install

1.8 copy the configuration file
[Root@mysql-5.5.11] # cp support-files/my-medium.cnf/etc/my. cnf

1.9 initialize the database
(Chmod 755 scripts/mysql_install_db is required to grant the File Execution permission before execution)

[Root @ localhost 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 set the startup of mysqld:
[Root@mysql-5.5.11] # cp support-files/mysql. server/etc/init. d/mysql

[Root@mysql-5.5.11] # chmod 755/etc/init. d/mysql

Chkconfig mysql on

1.11 configure the environment
For convenience, add the bin directory of mysql to PATH and add myslq/bin to/etc/profile. By the way, add two aliases to facilitate operations:

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

Switch Client

Alias mysql_start = "mysqld_safe &"

Alias mysql_stop = "mysqladmin-uroot-p shutdown"

1.12 start the mysql Service
[Root @ localhost mysql-5.5.11] #/etc/init. d/mysql start // server side Switch

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

[Root @ localhost mysql-5.5.11] #/mysql-u root-p // client switch refer to Article 1.11

2. Standard mysql installation settings

2.1 set the password for the root account
[Root @ localhost mysql-5.5.11] # mysqladmin-u root password 'yourpassword'

2.2 Delete an empty password account for anonymous connection to the Local Machine
Log on to mysql

[Root @ localhost mysql-5.5.11] # mysql-u root-p
Then enter the password set above and run the following command in the mysql command line after Logon:

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

Mysql> update user set password = 'root' 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. Implement the actual MySQL remote connection procedure

3.1 mysql database settings
[Root @ localhost 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. 192.% 'where user = '192. 0.0.1 ';

Mysql> grant all privileges on *. * to root @ '%' identified by "root"; // 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

3.2 mysql Windows Client
Download Client

Official mysql GUI

Set the username root password to root // The password just set above

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.