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