Linux installation mysql5.5.40

Source: Internet
Author: User

Linux installation mysql5.5.40

First, operating system and software

Operating system and version

Centos 6.4

Dependency Packages

GCC, gcc-c++, CMake, Ncurses-devel

Download catalogue

/opt

MySQL installation directory

/usr/local/mysql/

Ii. preparatory work

Operating system

Centos

Ubuntu

Installing CMake

Yum Install CMake

sudo apt-get install CMake

Installing Bison

Yum Install Bison

sudo apt-get install Bison

Installing GCC

Yum install-y gcc

sudo apt-get install gcc

Installing gcc-c++

Yum Install-y gcc-c++

sudo apt-get install gcc-c++

Installing Ncurses-devel

Yum Install Ncurses-devel

sudo apt-get install Ncurses-devel

Description: (mysql5.5 later compiled by CMake)

Third, the service installation steps

According to the order of the installation packages required by the service, complete the following table in steps, including the following steps:

A. Package installation and compilation B. Configuration file modification c. Permission settings

D. Initializing a database E. Start and Stop commands F. Verify that the service is working correctly

G. Boot auto-start H. environment variable configuration I. End Process and start

Step A

Package Installation and compilation

installation directory

/opt

Installation steps

  1. Download installer

Wge T http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.40.tar.gz

  1. unzip

Tar zxvf mysql-5.5.40.t ar.gz

  1. Enter directory

cd/opt/mysql-5.5.40

  1. compile and install

CMake.-dcmake_ins tall_prefix=/usr/local/mysql/-dmysql_datadir=/home/wkubuntu/mysql/data/-dmysql_unix_addr=/tmp/mysqld.sock- Dwith_innobase_storage_engine=1-denabled_local_infile=1-dmysql_tcp_port=3306-dextra_charsets=all-ddefault_ Charset=utf8-ddefault_collation=utf8_general_ci-dmysql_unix_addr=/tmp/mysql.sock-dmysql_user=mysql-dwith_debug =0

5. Description: The successful installation tag is as follows

CMake Warning:

Manually-specified variables were not used by the project:

Mysql_user

--Build files has been written to:/opt/mysql-5.5.40

6.make

7.make install

Step b

Configuration file Modification

Installation steps

1, install MySQL after the first step is to create a global configuration file my.cnf and adjust the relevant parameters, such as port, data file path, cache size, etc.:

sudo cp support-files/my-medium.cnf/etc/my.cnf

2. Create MySQL start and stop management scripts:

sudo cp support-files/mysql.server/etc/init.d/mysqld

"Note: The CP support-files/mysql.server/etc/init.d/mysql is so much better, the corresponding modifications later"

Step 3

Permission settings

Installation steps

chmod 755/etc/init.d/mysqld

Step 4

Initializing the database

Directory

/opt/mysql-5.5.40

Configuration steps

1. Groupadd MySQL

2. useradd-g MySQL MySQL

3. Sh./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/home/wkubuntu/mysql/data/

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

4. Description, install success token:

Installing MySQL system tables ...

Ok

Filling Help Tables ...

Ok

Step 5

Start and Stop commands

installation directory

/opt/mysql-5.5.40

Configuration steps

1. Start and Stop commands

/etc/init.d/mysqld start

/etc/init.d/mysqld stop

/etc/init.d/mysqld Restart Restart

Step 6

Verify that the service is working

Command

1. Enter the installation directory

Cd/usr/local/mysql/bin

2. Connection Login

./mysql-uroot–p

Password is empty

3. Change the password

Use MySQL;

Update user set Password=password (' New password ') where user= ' root ';

The password is updated in this step

Step Three:

Flush privileges; Refresh permissions.

Quit

4. Establishing a soft connection

Ln-s/usr/local/mysql/bin/mysql/usr/bin

5.mysql-uroot-p

You can enter your password

  1. View process

Pstree

Whether there are mysqld_safe, there, on behalf of OK, success

★-----------------------------------------★

Step 7

Boot auto Start

Command

Complete steps:

1, Support-files/mysql.server/etc/init.d/mysql

2, chmod 755/etc/init.d/mysql

3. Chkconfig MySQL on

Based on the previous configuration, this step actually only needs to input chkconfig mysqld on.

Step 8

Environment variable Configuration

Configuration content

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"

Step 9

End Process and start

Command

  1. Input command

Pstree-p

  1. End the corresponding PID program

KILL-9 Process PID Number

Note: To kill the daemon first, then kill the process. If the kill process is direct, the MySQL process will automatically generate a new process "

  1. Start

/etc/init.d/mysqld start

Iv. Common Error Resolution

    1. ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

Solution: Service not started

/etc/init.d/mysqld start

    1. During the entire installation process, the CMake installation was unsuccessful, which is the absence of the necessary front-most dependent packages, and if all are installed, the CMake installation is unsuccessful. Just RM–RF MySQL unpack the package, recompile the installation CMake again, can.

FIX: sudo rm/etc/mysql/my.cnf

3. Enter Mysql–uroot–p If prompted-bash:mysql:command not found

Workaround: This is because the system will find the command under/usr/bin by default and a soft connection can be

Ln-s/usr/local/mysql/bin/mysql/usr/bin

V. References and Web sites

    1. Http://www.cnblogs.com/bluewelkin/p/4233459.html
    2. Http://www.linuxidc.com/Linux/2011-04/35268.htm
    3. http://www.itpub.net/forum.php?mod=viewthread&tid=1811682&highlight=

------------------------------------------------------

Through the configuration as above, learned:

1, mysql-uroot-p ===================== command default location under/usr/bin to establish a soft connection can be

2, the role of the daemon process, kill the child process is also nothing, automatically generate new.

3, MySQL forgot the password is also OK http://www.cnblogs.com/bluewelkin/p/3902518.html

Add a sentence to MySQL's global configuration skip-grant-tables

4. Environment variable turn on alias mode

Linux installation mysql5.5.40

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.