CentOS install MySQL (Download the compressed package to unzip its own installation)

Source: Internet
Author: User
Tags centos

Installation of MySQL:

1. Add User Group
#> Groupadd MySQL
2, add Users
#> useradd-r-G MySQL MySQL
3, switch to the installation directory (take/usr/local as an example)
#> cd/usr/local
4, Decompression (Mysql-5.5.22-linux2.6-i686.tar.gz has been copied to/usr/local)
#> Tar zxvf mysql-5.5.22-linux2.6-i686.tar.gz
5, rename the directory name
#> MV mysql-5.5.22-linux2.6-i686 MySQL
6, delete the compressed package (operable)
#> RM mysql-5.5.22-linux2.6-i686.tar.gz
7, into the MySQL directory
#> CD MySQL
8, change user rights and group permissions
#> chown-r MySQL.
#> chgrp-r MySQL.
9. Initializing the database
<1> Guarantee There is no my.cnf under the/etc/directory, if you please delete
<2> Initializing DB
#> Scripts/mysql_install_db–user=mysql

After the completion of the above, according to the prompts to see whether the success, did not succeed on their own reasons.

MySQL's configuration:

Configuring MySQL is primarily my.cnf files and startup files. These two files are available under the installation directory, and are copied to the specified directory.

#> CP support-files/my-default.cnf/etc/my.cnf
#> CP Support-files/mysql.server/etc/rc.d/init.d/mysql

In general, the my.cnf file must modify the configuration itself. A lot of profiles on the web, do not introduce.

Set a password for the root user of MySQL:

#>./bin/mysqladmin-u root password ' 123456′

The Mysql.server file will not need to be modified. However, you may need to modify your installation directory if it is not/usr/local and you may want to modify the Basedir in this file to your installation directory.

The aftermath of MySQL:

After completing the above configuration, you should be able to service MySQL start in the terminal to start the MySQL services, you can use the Netstat-ant command to see the MySQL default 3306 port is not open.

However, the MySQL command is not recognized in the terminal. You need to add the/usr/local/mysql/bin directory to the environment variable path or make a soft connection to the/usr/bin below.

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

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.