MySQL 8.0 installation

    The official version 8.0.11 of MySQL 8.0 has been officially released. Before that, we have learned about the huge changes in this version. In order to find out, let's install it first.

   download   wget https://dev.mysql.com/downloads/file/?id=476451

   CentOS system

[root@DBTest38 opt]# uname -a
Linux DBTest38 2.6.32-642.15.1.el6.x86_64

    New installation, database directory

mkdir /opt/mysql
mkdir /data/mysql/mysql3306

    Create a new mysql user

groupadd mysql
useradd -g mysql mysql

    Unzip the installation package

cd /opt/mysql
tar zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz

#V5.7 V8.0 file size comparison, 8.0 is relatively smaller
623M  mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
2.5G  ./mysql-5.7.17-linux-glibc2.5-x86_64
1.3G ./mysql-5.7.17-linux-glibc2.5-x86_64/bin

575M  mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz
1.8G ./mysql/mysql-8.0.11-linux-glibc2.12-x86_64
1.5G  ./mysql/mysql-8.0.11-linux-glibc2.12-x86_64/bin

    Establish source file link  ln -s /opt/mysql/mysql-8.0.11-linux-glibc2.12-x86_64 /usr/local/mysql

    Modify directory permissions

chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /opt/mysql
chown -R mysql:mysql /data/mysql/mysql3306

    Simple configuration my.cnf

[root@DBTest38 mysql]# cat /etc/my.cnf
[client]
port      = 3306
socket    = /tmp/mysql.sock
[mysqld]
port      = 3306
user      = mysql
socket    = /tmp/mysql.sock
basedir   = /usr/local/mysql
datadir   = /data/mysql/mysql3306/
log-error = error.log
server-id = 330638

    Initialize the database  

#Initialize with password
mysqld --defaults-file=/etc/my.cnf --initialize

#initialize without password
mysqld --defaults-file=/etc/my.cnf --initialize-insecure

    Start the database  mysqld --defaults-file=/etc/my.cnf &

    Get the database temporary password and log in to the database

[root@DBTest38 mysql3306]# cat error.log |grep password
2018-04-23T06:43:28.740843Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: woE5?dj<ocad
[root@DBTest38 mysql3306]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.11

Copyright (c) 2000, 2018, 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.

(product)root@localhost [(none)]> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
#After the first login, you need to change the root password
(product)root@localhost [(none)]> alter user root@localhost identified by 'root';
Query OK, 0 rows affected (0.08 sec)

(product)root@localhost [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.07 sec)

    After a brief look at the files in the data directory, I found two interesting problems:

#mysql and other tables in the mysql library are gone, the black technology of changing the root password before V5.7 is estimated to be useless
[root@DBTest38 mysql3306]# ll /data/mysql/mysql3306/mysql
total 28
-rw-r----- 1 mysql mysql  5521 Apr 23 14:43 general_log_195.sdi
-rw-r----- 1 mysql mysql    35 Apr 23 14:43 general_log.CSM
-rw-r----- 1 mysql mysql     0 Apr 23 14:43 general_log.CSV
-rw-r----- 1 mysql mysql 11746 Apr 23 14:43 slow_log_196.sdi
-rw-r----- 1 mysql mysql    35 Apr 23 14:43 slow_log.CSM
-rw-r----- 1 mysql mysql     0 Apr 23 14:43 slow_log.CSV
# undo is split from ibdata
[root@DBTest38 mysql3306]# ll
total 168016
-rw-r----- 1 mysql mysql       56 Apr 23 14:43 auto.cnf
-rw-r----- 1 mysql mysql      850 Apr 23 15:46 binlog.000001
-rw-r----- 1 mysql mysql       16 Apr 23 14:46 binlog.index
-rw------- 1 mysql mysql     1680 Apr 23 14:43 ca-key.pem
-rw-r--r-- 1 mysql mysql     1112 Apr 23 14:43 ca.pem
-rw-r--r-- 1 mysql mysql     1112 Apr 23 14:43 client-cert.pem
-rw------- 1 mysql mysql     1680 Apr 23 14:43 client-key.pem
-rw-r----- 1 mysql mysql        5 Apr 23 14:46 DBTest38.pid
-rw-r----- 1 mysql mysql      969 Apr 23 14:46 error.log
-rw-r----- 1 mysql mysql     5927 Apr 23 14:43 ib_buffer_pool
-rw-r----- 1 mysql mysql 12582912 Apr 23 15:46 ibdata1
-rw-r----- 1 mysql mysql 50331648 Apr 23 15:46 ib_logfile0
-rw-r----- 1 mysql mysql 50331648 Apr 23 14:43 ib_logfile1
-rw-r----- 1 mysql mysql 12582912 Apr 23 14:46 ibtmp1
drwxr-x--- 2 mysql mysql     4096 Apr 23 14:43 mysql
-rw-r----- 1 mysql mysql 25165824 Apr 23 15:46 mysql.ibd
drwxr-x--- 2 mysql mysql     4096 Apr 23 14:43 performance_schema
-rw------- 1 mysql mysql     1676 Apr 23 14:43 private_key.pem
-rw-r--r-- 1 mysql mysql      452 Apr 23 14:43 public_key.pem
-rw-r--r-- 1 mysql mysql     1112 Apr 23 14:43 server-cert.pem
-rw------- 1 mysql mysql     1676 Apr 23 14:43 server-key.pem
drwxr-x--- 2 mysql mysql     4096 Apr 23 14:43 sys
-rw-r----- 1 mysql mysql 10485760 Apr 23 15:46 undo_001
-rw-r----- 1 mysql mysql 10485760 Apr 23 15:46 undo_002
drwxr-x--- 2 mysql mysql     4096 Apr 23 15:46 yxli

  As for the changes in 8.0, I will find out later, and today's installation article is here.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324803833&siteId=291194637
Recommended