Summary of the process for installing the MySQL database on Centos-6.9-x86_64-minimal

Source: Internet
Author: User
Tags mysql commands server port

1. Create MySQL user, MySQL group.

# useradd-s/bin/nologin-m MySQL

See if the creation was successful.

# ID MySQL

2. The MySQL-speaking binary package is extracted to the/usr/local/directory.

# cd/usr/local/

# TAR-ZXVF mysql-5.7.20-linux-glibc2.5-x86_64.tar.gz (different versions are different)

Rename the extracted folder to facilitate future operation.

# mv mysql-5.7.20-linux-glibc2.5-x86_64 MySQL (change file name to MySQL)

#cd MySQL

# Chowm-r Mysql.mysql.

#这一步很重要, be sure not to forget to modify permissions.

#查看权限是否修改.

#ls-L (or LL)


3. Initialize the database.

MySQL folder in the support-files contains the MySQL sample configuration file and service startup script
The bin contains important MySQL commands (for initializing databases, backup, replication, etc.)

# bin/mysqld--initialize--user=mysql--datadir=/usr/local/mysql/data (Remember password password for "A temporary password are generated for [em AIL protected]: t3c2o26 "t3c2o26") if initialization is unsuccessful, enter yum-y install Numactl

The--initialize is used to initialize the database and generate a random initial password, which can be printed on the screen, or by viewing the data directory.
--datadir is used to store database directories (data directories in production environments, log directories to use separate disk storage).

# CP Support-files/mysql.server/etc/init.d/mysqld

#让mysql使用服务做为守护进程.

4. Edit the MySQL configuration file.
# VI/ETC/MY.CNF

Data:
DataDir =/usr/local/mysql/data/
port=3306
Socket=/tmp/mysql.sock
key_buffer_size=16m
Max_allowed_packet=8m

This is my configuration file, only the simplest configuration, the following can be configured according to the specific needs of the corresponding parameters

5. Start the database below

# service Mysqld Start

#出现SUCCESS说明启动成功.

View the server port status.

# NETSTAT-TULNP

Use the command line to enter MySQL.

#/usr/local/mysql/bin/mysql–u Root–p

Enter database Change Password

# SET PASSWORD = PASSWORD (' 123456 ');

Summary of the process for installing the MySQL database on Centos-6.9-x86_64-minimal

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.