Ubuntu Server 12.04 installs MySQL 5.6.10 learning notes

Source: Internet
Author: User
Tags file copy

First, download the binary version of the MySQL package: http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz

Because the wget on Ubuntu server is slow, so I am directly in Windows to download good, and then WINSCP upload to the server, see their preferences.

to the point.

The packages are placed in the ~/download directory, and all the installation commands are as follows:

1, decompression tar.gz

The code is as follows Copy Code

Tar–xzf mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz

2, rename the extracted folder

The code is as follows Copy Code

MV Mysql-5.6.10-linux-glibc2.5-x86_64 MySQL

3, the MySQL folder to move to the/usr/local directory

The code is as follows Copy Code

sudo mv mysql/usr/local

4, into the MySQL directory

The code is as follows Copy Code

Cd/usr/local/mysql

5, increase the MySQL user group

The code is as follows Copy Code

sudo groupadd MySQL

6, increase the MySQL user

The code is as follows Copy Code

sudo useradd-r-g MySQL MySQL

7, the MySQL folder own and GRP change to MySQL

The code is as follows Copy Code

sudo chown-r MySQL.

sudo chgrp-r MySQL.

8. Execute MySQL Installation script

The code is as follows Copy Code

sudo scripts/mysql_install_db--user=mysql

(If the Libaio package is not installed, there will be an error prompts, install Libaio-dev, then run the script)

The code is as follows Copy Code

sudo apt-get install Libaio-dev

9, will change the directory permissions, only keep the data directory for MySQL users

The code is as follows Copy Code

sudo chown-r root.

sudo chown-r mysql data

10, the MySQL configuration file copy to the ETC directory (global configuration)

Note: The default profile name for version 5.6 is changed by the original My-medium to My-default.

The code is as follows Copy Code

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

11. Start MySQL

The code is as follows Copy Code

sudo bin/mysqld_safe--user=mysql &

12, initialize the MySQL root user password

The code is as follows Copy Code

sudo bin/mysqladmin-u root password ' cipher text '

13, copy Mysql.server script to/ETC/INIT.D (initialization service, some people like to change to mysqld, here can be changed)

The code is as follows Copy Code

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

14. View MySQL Running status

sudo service mysql.server status
If it works, the MySQL running is displayed.

If not running is displayed, it should be a service that is not started before, and can be started directly with services Mysql.server start

The code is as follows Copy Code

sudo service mysql.server [status|start|stop]

15, let MySQL boot [defaults], cancel boot [remove]

The code is as follows Copy Code

sudo update-rc.d-f mysql.server defaults [remove]

16, add the Mysql/bin/mysql command to the user command, or add the Mysql/bin directory to the path

Add user command:

The code is as follows Copy Code

sudo ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql

To add an environment variable:

The code is as follows Copy Code

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

17. Allow remote login of root user

  code is as follows copy code

1> Enter Mysql:mysql–u root–p

2> change database: use MySQL;

3> log on from any host: Grant all privileges on *.* to root@ "%" identified by "cipher text" with GRANT option;

4> Log on from the specified host: Grant all privileges on *.* to root@ "192.168.1.101" identified by "Passw0rd" with grant option;

5> authorization is in effect: flush privileges;

6> See whether the host is authorized to add: SELECT * from user;

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.