配置mysql的my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It¡®s a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /data/mysql
datadir = /data/mysql/data
port = 3306
server_id = 100
socket = /tmp/mysql.sock
lower_case_table_names=1
skip-name-resolve
wait_timeout=1000000
interactive_timeout=1000000
# bind_address=127.0.0.1
#skip-grant-tables
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
1.新建mysql用戶
groupadd -g 701 mysql
useradd -M -g mysql mysql
2.在mysql安裝路徑下建data,log目錄,並賦予用戶權限
chown -R mysql:mysql ./data
chown -R mysql:mysql ./log
3.初始化數據庫
./bin/mysqld --initialize --user=mysql --basedir=/data/mysql-5.7.20-linux-glibc2.12-x86_64 --datadir=/data/mysql-5.7.20-linux-glibc2.12-x86_64/data
其中有一行告訴你密碼: temporary password is generated for root@localhost: eqzlq3dy6l%D
4.開啓mysql,登錄數據庫
cp /data/mysql-5.7.20-linux-glibc2.12-x86_64/support-files/mysql.server /etc/init.d/mysqld
service mysqld start
./bin/mysql -uroot -p eqzlq3dy6l%D
5.修改密碼
alter user 'root'@'localhost' identified by 'iec61850';
6.開放遠程登錄
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'iec61850' WITH GRANT OPTION;
FLUSH PRIVILEGES;