Installing the MySQL Database

Source: Internet
Author: User

1) Create MySQL user account

[[email protected] ~]# Groupadd MySQL

[Email protected] ~]# useradd-s/sbin/nologin-g mysql-m MySQL

Check the MySQL users and groups that you just created, and then kill:

[Email protected] ~]# tail-1/etc/passwd

Mysql:x:1001:1001::/home/mysql:/sbin/nologin

You can see that the MySQL users and groups have been created successfully.

Now set up a fixed directory to store so the software, the command is as follows:

[Email protected] ~]# mkdir-p/home/cheac/tools

[Email protected] ~]# Cd/home/cheac/tools

2) Get MySQL Package

Link: http://pan.baidu.com/s/1pLNmZB9 Password: Qkzu

[Email protected] ~]# Tar XF mysql-5.5.49.tar.gz

[Email protected] ~]# mkdir-p/application/

[Email protected] ~]# Tar XF mysql-5.5.49.tar.gz

[[Email protected] ~]# MV mysql-5.5.49/application/mysql-5.5.49 (move and rename)

Create a soft connection, generate a access path that removes the version number, and view it.

[Email protected] tools]# ln-s/application/mysql-5.5.49//application/mysql

[Email protected] tools]# ls-l/application/

Next initialize the MySQL configuration file my.cnf

[Email protected] tools]# cd/application/mysql/

[Email protected] mysql]# ls-l support-files/*.cnf

-rw-r--r--1 7161 wheel 4691 June support-files/my-huge.cnf

-rw-r--r--1 7161 wheel 19759 June support-files/my-innodb-heavy-4g.cnf

-rw-r--r--1 7161 wheel 4665 June support-files/my-large.cnf

-rw-r--r--1 7161 wheel 4676 June support-files/my-medium.cnf

-rw-r--r--1 7161 wheel 2840 June support-files/my-small.cnf

[Email protected] mysql]#/BIN/CP support-files/my-small.cnf/etc/my.cnf

Initialize the MySQL database file with the following command:

[[email protected] mysql]# mkdir-p/application/mysql/data (build MySQL data file directory)

[[email protected] mysql]# chown-r mysql.mysql/application/mysql/(authorized MySQL user to manage MySQL's records)

[Email protected] mysql]#/application/mysql/scripts/mysql_install_db--basedir=/application/mysql--datadir=/ Application/mysql/data--user=mysql (Initialize the MySQL database file, there will be a lot of information, error level errors, there will be two OK words, indicating that the initialization is successful, or it is necessary to solve the problem of initialization)

The main purpose of the above command is to generate the following database files:

[Email protected] mysql]# tree/application/mysql/data/

/application/mysql/data/

|--MySQL

| |--Columns_priv. MYD

| |--Columns_priv. MYI

| |--columns_priv.frm

| |--db. MYD

| |--db. MYI

| |--db.frm

| |--event. MYD

| |--event. MYI

| |--event.frm

... Omit a number of ...

Configure and start the script with the following command:

[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld

[Email protected] mysql]# chmod +x/etc/init.d/mysqld

MySQL binary default installation path is/usr/local/mysql, the boot script is the path of/usr/local/mysql needs to be replaced, the command is as follows:

[Email protected] mysql]# sed-i ' s#/usr/local/mysql#/application/mysql#g '

/application/mysql/bin/mysqld_safe/etc/init.d/mysqld

Start the MySQL database with the following command:

[[email protected] mysql]#/etc/init.d/mysqld start

Starting MySQL. success!

Check that the MySQL database is started with the following command:

[[email protected] mysql]# netstat-lntup|grep MySQL

TCP 0 0.0.0.0:3306 0.0.0.0:* LISTEN 9874/mysqld

If you find that the 3306 port is not up, please tail-100/application/mysql/data/the machine name. Err View log information to see if there is an error message, and then debug according to the relevant errors

All right, MySQL is ready to install!


This article refers to "old boy" books, "Learn Linux with old boys", Old boy Blog: http://oldboy.blog.51cto.com/



This article is from the "11727842" blog, please be sure to keep this source http://11737842.blog.51cto.com/11727842/1933541

Installing the MySQL Database

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.