MYSQL8 Installation Record

Source: Internet
Author: User
Tags create directory mkdir reserved

Operating Environment: centos6.6+mysql8.0.12

1. Download the official packaged binary installation package:

#wget HTTPS://CDN.MYSQL.COM//DOWNLOADS/MYSQL-8.0/MYSQL-8.0.12-LINUX-GLIBC2.12-X86_64.TAR.XZ
You can see that this version uses the TAR.XZ packaging compression method, the file only about 350M, download is full of convenience.
Du-sh MYSQL-8.0.12-LINUX-GLIBC2.12-X86_64.TAR.XZ
339M MYSQL-8.0.12-LINUX-GLIBC2.12-X86_64.TAR.XZ

2. Unzip the file:

#tar-XJVF mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz-c/usr/local/
mv/usr/local/mysql-8.0.12-linux-glibc2.12-x86_64//usr/local/mysql

3. Configuration parameter file:

Cat/etc/my.cnf
[Mysqld]
Server-id = 1
Port = 3306
Mysqlx_port = 33060
Mysqlx_socket =/tmp/mysqlx.sock
DataDir =/data/mysql
Socket =/tmp/mysql.sock
Pid-file =/tmp/mysqld.pid
Log-error = Error.log
Slow-query-log = 1
Slow-query-log-file = Slow.log
Long_query_time = 0.2
Log-bin = Bin.log
Relay-log = Relay.log
Binlog_format =row
Relay_log_recovery = 1
Character-set-client-handshake = FALSE
Character-set-server = Utf8mb4
Collation-server = Utf8mb4_unicode_ci
Init_connect = ' SET NAMES utf8mb4 '
Innodb_buffer_pool_size = 1G
Join_buffer_size = 128M
Sort_buffer_size = 2M
Read_rnd_buffer_size = 2M
Log_timestamps = SYSTEM
Lower_case_table_names = 1
Default-authentication-plugin =mysql_native_password

4. Create directory authorization, etc.:

Groupadd MySQL
Useradd MySQL
Mkdir-p/data/mysql
Chown-r mysql:mysql/data/mysql/
Chmod-r 775/data/mysql/

5. Initialize the database:

#/usr/local/mysql/bin/mysqld--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql--initialize-insecure
The official recommended use of--initialize, will generate in the error log difficult to enter the temporary password, I use the password-free way.

Cat/data/mysql/error.log | Grep-i Password
2018-07-29t02:06:41.253856+08:00 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: Wq ur3-kxlg1d

6. Set the startup file and environment variables:

#cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql

--Start the database:

/etc/init.d/mysql start
Starting mysql.logging to '/data/mysql/error.log '.
success!

vim/etc/profile.d/mysql.sh
cat/etc/profile.d/mysql.sh
Export path= $PATH:/usr/local/mysql/bin
source/etc/profile.d/mysql.sh
Mysqld--version
Mysqld Ver 8.0.12 for linux-glibc2.12 on x86_64 (MySQL Community SERVER-GPL)
[Email protected] mysql]#/usr/local/mysql/bin/mysql-p-s/tmp/mysql.sock
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 7
Server version:8.0.12 MySQL Community SERVER-GPL
Copyright (c), 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql> select version ();
+-----------+
| Version () |
+-----------+
| 8.0.12 |
+-----------+
1 row in Set (0.00 sec)

7. Set up an account that can log in remotely:

Mysql> Show variables like '%valid%pass% ';
Empty Set (0.00 sec)
mysql> create user [email protected] '% ' identified by ' Oracle ';
ERROR 1290 (HY000): The MySQL server is running with the--skip-grant-tables option so it cannot execute this statement
Mysql> Show variables like '%valid%pass% ';
ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.
mysql> alter user [email protected] ' localhost ' identified by ' Oracle ';
Query OK, 0 rows affected (0.07 sec)
Mysql> Show variables like '%valid%pass% ';
Empty Set (0.01 sec)

--Create a user who can log on remotely:

mysql> create user [email protected] '% ' identified by ' Oracle ';
Query OK, 0 rows affected (0.06 sec)
Mysql> Grant all privileges the [email protected] '% ' with GRANT option;
Query OK, 0 rows affected (0.07 sec)
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

Recording

Extract
Dosage 930616
-rw-r--r--. 1 root root 50345454 June 5 18:44 grafana-4.5.2-1.x86_64.rpm
-rw-r--r--. 1 root root 17067970 June 5 18:41 influxdb-1.2.0.x86_64.rpm
-rw-r--r--. 1 root root 185646832 August 22:57 jdk-8u181-linux-x64.tar.gz
-rw-r--r--. 1 root root 344964868 August 1 19:44 mysql-8.0.12-linux-glibc2.12-i686.tar.xz
-rw-r--r--. 1 root root 354913940 August 10:01 mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz
[Email protected] home]#
[Email protected] home]# TAR-XJVF mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz-c/usr/local/

Copied to
[Email protected] home]# mv/usr/local/mysql-8.0.12-linux-glibc2.12-x86_64//usr/local/mysql
[Email protected] home]#
Configuration file:
[Email protected] mysql]#
[Email protected] mysql]#
[Email protected] mysql]# cd/etc/
[Email protected] etc]# MV MY.CNF My.cnf.bak
[Email protected] etc]# vim my.cnf
[Mysqld]
Server-id = 1
Port = 3306
Mysqlx_port = 33060
Mysqlx_socket =/tmp/mysqlx.sock
DataDir =/data/mysql
Socket =/tmp/mysql.sock
Pid-file =/tmp/mysqld.pid
Log-error = Error.log
Slow-query-log = 1
Slow-query-log-file = Slow.log
Long_query_time = 0.2
Log-bin = Bin.log
Relay-log = Relay.log
Binlog_format =row
Relay_log_recovery = 1
Character-set-client-handshake = FALSE
Character-set-server = Utf8mb4
Collation-server = Utf8mb4_unicode_ci
Init_connect = ' SET NAMES utf8mb4 '
Innodb_buffer_pool_size = 1G
Join_buffer_size = 128M
Sort_buffer_size = 2M
Read_rnd_buffer_size = 2M
Log_timestamps = SYSTEM
Lower_case_table_names = 1
Default-authentication-plugin =mysql_native_password
~
"MY.CNF" [New] 27L, 1083C written
[Email protected] etc]#
[Email protected] etc]#
[Email protected] etc]#
[Email protected] etc]#
[Email protected] etc]# mkdir-p/data/mysql
[Email protected] etc]# chown-r mysql:mysql/data/mysql/
[Email protected] etc]# chmod-r 775/data/mysql/
[Email protected] etc]#
/usr/local/mysql/bin/mysqld--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql--initialize-insecure
[Email protected] etc]# Cat/data/mysql/error.log | Grep-i Password
2018-08-25t21:10:11.470522+08:00 5 [Warning] [MY-010453] [Server] [email protected] is created with an empty password! Please consider switching off the--initialize-insecure option.
~
"Profile.d/mysql.sh" [New] 2L, 69C written
[Email protected] etc]#
[Email protected] etc]# source/etc/profile.d/mysql.sh
[Email protected] etc]#
[Email protected] etc]# mysqld--version
Mysqld Ver 8.0.12 for linux-glibc2.12 on x86_64 (MySQL Community SERVER-GPL)
[Email protected] etc]#/usr/local/mysql/bin/mysql-p-s/tmp/mysql.sock
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 8
Server version:8.0.12 MySQL Community SERVER-GPL

Copyright (c), 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql> select version ();
+-----------+
| Version () |
+-----------+
| 8.0.12 |
+-----------+
1 row in Set (0.00 sec)

Mysql> Show variables like '%valid%pass% ';
Empty Set (0.02 sec)

Mysql> Show variables like '%valid%pass% ';
Empty Set (0.02 sec)

mysql> create user [email protected] '% ' identified by ' admin ';
Query OK, 0 rows affected (0.10 sec)

mysql> alter user [email protected] ' localhost ' identified by ' admin ';
Query OK, 0 rows affected (0.05 sec)

Mysql> Show variables like '%valid%pass% ';
Empty Set (0.01 sec)

mysql> create user [email protected] '% ' identified by ' admin ';
ERROR 1396 (HY000): Operation CREATE USER failed for ' root ' @ '% '
Mysql> Grant all privileges the [email protected] '% ' with GRANT option;
Query OK, 0 rows affected (0.08 sec)

mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

Mysql>

MYSQL8 Installation Record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.