linux install mysql5.7.23.tar.gz

1, extract, modify the file name
tar -zxvf filename
# decompression
mv oldfilename newfilename
# modify the file name
2, create a folder
mkdir the Data
#data directory
mkdir our sock
#sock directory
mkdir log
#log directory
mkdir pid
# PID directory
3, the configuration file
vim /etc/my.cnf
----------
[mysqld]
User MySQL =
# = the bind-address 0.0.0.0
# access address
Port = 3306
the basedir = main program directory
datadir = data directory
socket = sock directory / mysql.sock
PID-PID = File directory /mysql.pid
log-error = log directory /mysql-error.log

symbolic links = 0-
default-Storage-Engine = INNODB
the character_set_server = UTF8
collation = utf8_general_ci-Server
the READ-to REPEATABLE = transaction_isolation
the sql_mode = NO_ENGINE_SUBSTITUTION, the STRICT_TRANS_TABLES
skip_ssl
default-Time-Zone = '+ 8:00'
innodb_buffer_pool_instances. 1 =
max_connections = 200 is
lower_case_table_names. 1 =
# Configure case 1, mysql will first table lowercase. 2, mysql directly operate according to the table name, case sensitive.
max_allowed_packet = 16M
maximum packet size of the send and receive server #

[MySQL]
default = UTF8 SET-Character-
Port = 3306
Socket = our sock directory /mysql.sock
----------
. 4, the user creates the group
groupadd MySQL
# create a group
useradd mysql -g mysql -d main program directory -s / sbin / nologin
# creating a user, specify the home directory, specify the login shell
passwd MySQL
# create a password
5, modify the file permissions
chown -R mysql: mysql program's main directory (data directory, sock directory, pid directory, log directory, / etc / my.cnf)
6, initialization MySQL
yum the install libaio *
# installation depends
cd main program directory / bin
./mysqld --initialize MySQL --basedir --user = = main program directory --datadir = data catalog
7, database encryption
 ./mysql_ssl_rsa_setup - datadir = data directory
8, startup script
CD / MySQL / Support-Files /
CP /etc/init.d/mysqld the mysql.server
Vim /etc/init.d/mysqld
the basedir = main program directory
datadir = data directory
9, start the database
Start mysqld Service
PS -ef | grep MySQL
10, modify the database password
cd main program directory / bin
./mysql-uroot--p
# password stored in the log directory /mysql-error.log
login execute
mysql> set password = password ( ' 123456 ');
11, a boot
the chkconfig --add mysqld
the chkconfig mysqld ON
the chkconfig --list | grep mysqld
12, set the environment variable
Vim /etc/profile.d/mysql.sh
----------
MYSQL_HOME is the main program directory =
the PATH the PATH = $: $ MYSQL_HOME is / bin
Export the PATH MYSQL_HOME is
------- ---
# verify successful mysql --version or the PATH $ echo $ MYSQL_HOME echo
13, open port
Firewall-cmd = --zone public --add-port = 3306 / tcp --permanent
Firewall-cmd --reload
14, set up remote access
MYSQL want others to remotely access to your database, you must let mysql database host field in the user table is%, accept remote control requests, you can enter mysql> use mysql;
mysql> Update user the sET host = "%" the WHERE user = "root" and host = "localhost"; so that others can mysql -h xxx.xxx.xxx.xxx (IP of your computer) -u root -p password
to restart the database


https://www.linuxidc.com /Linux/2017-03/142363.htm


Guess you like

Origin www.cnblogs.com/lazy-sang/p/11573952.html
Recommended