centos8上安装mysql5.7.16

前端之家收集整理的这篇文章主要介绍了centos8上安装mysql5.7.16前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
[root@iZwz94knyxhkgqeu5pve0zZ bin]# cd /usr/local/MysqL
[root@iZwz94knyxhkgqeu5pve0zZ MysqL]# bin/MysqLd --initialize --user=MysqL --basedir=/u
sr/local/MysqL
2017-04-21T01:09:02.837622Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-21T01:09:05.621663Z 0 [Warning] InnoDB: New log files created,LSN=45790
2017-04-21T01:09:06.007022Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-04-21T01:09:06.103758Z 0 [Warning] No existing UUID has been found,so we assume that this is the first time that this server has been started. Generating a new UUID: 1da93999-262f-11e7-a713-00163e06a307.
2017-04-21T01:09:06.109542Z 0 [Warning] Gtid table is not ready to be used. Table 'MysqL.gtid_executed' cannot be opened.
2017-04-21T01:09:06.110557Z 1 [Note] A temporary password is generated for root@localhost: MX,)LrHRq6gn
[root@iZwz94knyxhkgqeu5pve0zZ MysqL]# bin/MysqL_ssl_rsa_setup
Generating a 2048 bit RSA private key
.........+++
................................................................................................................................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
...............+++
..........................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
........+++
........................................+++
writing new private key to 'client-key.pem'
-----
[root@iZwz94knyxhkgqeu5pve0zZ MysqL]# cd /usr/local/MysqL/support-files
[root@iZwz94knyxhkgqeu5pve0zZ support-files]# cp my-default.cnf /etc/my.cnf
[root@iZwz94knyxhkgqeu5pve0zZ support-files]# cp MysqL.server /etc/init.d/MysqL
[root@iZwz94knyxhkgqeu5pve0zZ support-files]# vim /etc/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 = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# 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
~
~
~
~
~
~
~
"/etc/my.cnf" 31L,1126C 1,1 All
# 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,remove the # and set as required.
basedir = /usr/local/MysqL
datadir = /usr/local/MysqL/data
port = 3306
# server_id = .....
socket = /tmp/MysqL.sock
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed,1154C written
[root@iZwz94knyxhkgqeu5pve0zZ support-files]# cd ../
[root@iZwz94knyxhkgqeu5pve0zZ MysqL]# bin/MysqLd-safe --user=MysqL &
[1] 21491
[root@iZwz94knyxhkgqeu5pve0zZ MysqL]# cd data
[root@iZwz94knyxhkgqeu5pve0zZ data]# chmod a+rw server-key.pem
[root@iZwz94knyxhkgqeu5pve0zZ data]# cd ../
[root@iZwz94knyxhkgqeu5pve0zZ MysqL]# bin/MysqLd_safe --user=MysqL &
[2] 21686
[root@iZwz94knyxhkgqeu5pve0zZ MysqL]# bin/MysqL --user=root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@iZwz94knyxhkgqeu5pve0zZ MysqL]# bin/MysqL --user=root -p
Enter password:
Welcome to the MysqL monitor. Commands end with ; or \g.
Your MysqL connection id is 8
Server version: 5.7.16
Copyright (c) 2000,2016,Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MysqL> set password=password('123456');
Query OK,0 rows affected,1 warning (0.00 sec)
MysqL> grant all privileges on *.* to root@'%' identified by '123456';
Query OK,1 warning (0.00 sec)
MysqL> flush privileges;
Query OK,0 rows affected (0.00 sec)
另外启动一个窗口,/etc/profile文件修改添加一句话export PATH=/usr/local/MysqL/bin:$PATH
vim /etc/profile的过程省略
[root@iZwz94knyxhkgqeu5pve0zZ ~]# source /etc/profile
[root@iZwz94knyxhkgqeu5pve0zZ ~]# chmod 755 /etc/init.d/MysqL
[root@iZwz94knyxhkgqeu5pve0zZ ~]# chkconfig --add MysqL
[root@iZwz94knyxhkgqeu5pve0zZ ~]# chkconfig --level 345 MysqL on

注意绿色的字体是生成MysqL初始化密码啊

结束

猜你在找的CentOS相关文章