二进制部署8版本:
卸载mariadb软件:
[root@mysql ~]
mariadb-libs-5.5.56-2.el7.x86_64
[root@mysql ~]
解压二进制包:
[root@mysql ~]
[root@mysql ~]
[root@mysql ~]
[root@mysql ~]
[root@mysql ~]
创建mysql用户:
[root@mysql ~]
[root@mysql ~]
[root@mysql ~]
初始化数据:
[root@mysql ~]
添加配置文件:
[root@mysql ~]
[mysqld]
server_id=1
user=mysql
port=3306
bind-address=0.0.0.0
basedir=/usr/local/mysql-8.0.16
datadir=/usr/local/mysql-8.0.16/data
socket=/tmp/mysql.sock
log_error=/usr/local/mysql-8.0.16/logs/mysql.log
[mysql]
socket=/tmp/mysql.sock
启动MySQL-8.0服务:
[root@mysql ~]
[root@mysql ~]
Starting MySQL.Logging to '/usr/local/mysql-8.0.16/data/mysql.err'.
.. SUCCESS!
或者---------------------------------------------------------------------------------------------
[root@mysql ~]
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql-8.0.16/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
[root@mysql ~]
[root@mysql ~]
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /etc/systemd/system/mysqld.service.
[root@mysql ~]
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1232/mysqld
tcp6 0 0 :::33060 :::* LISTEN 1232/mysqld
添加mysql环境变量:
[root@mysql ~]
[root@mysql ~]
修改root随机密码:
[root@mysql ~]
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16
Copyright (c) 2000, 2019, 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> alter user root@localhost identified by '123456';
[root@mysql ~]
+-----------+
| @@version |
+-----------+
| 8.0.16 |
+-----------+