Summary of the process for installing a mysql database on a CentOS-6.9-x86_64-minimal,

Source: Internet
Author: User

Summary of the process for installing a mysql database on a CentOS-6.9-x86_64-minimal,

1. Create a mysql user and a mysql group.

# Useradd-s/bin/nologin-M mysql

Check whether the creation is successful.

# Id mysql

2. Extract the mysql binary package to the/usr/local/directory.

# Cd/usr/local/

# Tar-zxvf mysql-5.7.20-linux-glibc2.5-x86_64.tar.gz (different versions)

Rename the decompressed folder for future operations.

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

# Cd mysql

# Chowm-R mysql. mysql.

# This step is very important. Do not forget to modify the permission.

# Check whether the permission is modified.

# Ls-l (or ll)


3. initialize the database.

The support-files in the Mysql folder contains the mysql sample configuration file and Service Startup Script.
Bin stores important mysql commands (used for database initialization, backup, replication, etc)

# Bin/mysqld -- initialize -- user = mysql -- datadir =/usr/local/mysql/data (remember that the password is "A temporary password is generated for root @ localhost: t3c2O26 "T3c2O26") if initialization fails, enter yum-y install numactl

-- Initialize is used to initialize the database and generate a random initial password. The password is printed on the screen. You can also view the password in the data directory.
-- Datadir is used to store database directories (Data Directories and log directories in the production environment must be stored on separate disks ).

# Cp support-files/mysql. server/etc/init. d/mysqld

# Use mysql as a daemon.

4. Modify and edit the mysql configuration file.
# Vi/etc/my. cnf

Data:
Datadir =/usr/local/mysql/data/
Port = 3306
Socket =/tmp/mysql. sock
Key_buffer_size = 16 M
Max_allowed_packet = 8 M

This is my configuration file, which only provides the simplest configuration. You can configure the relevant parameters as needed.

5. Start the database

# Service mysqld start

# SUCCESS indicates that the startup is successful.

View the server port status.

# Netstat-tulnp

Use the command line to enter mysql.

#/Usr/local/mysql/bin/mysql-u root-p

Go to the database and change the password

# Set password = PASSWORD ('123 ');

 

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.