Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql8 installation record

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Operating environment: centos6.6+mysql8.0.12

1. Download the officially 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 and compression method, the file is only about 350m, the download is quite convenient.

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

two。 Extract 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

It is officially recommended to use-initialize, which will generate temporary passwords that are difficult to enter in the error log. I use the password-free method here.

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 root@localhost: wquR3-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 x8634 (MySQL Community Server-GPL)

[root@node4 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) 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.

Mysql > select version ()

+-+

| | version () |

+-+

| | 8.0.12 |

+-+

1 row in set (0.00 sec)

7. Set up accounts that can be logged in remotely:

Mysql > show variables like'% valid%pass%'

Empty set (0.00 sec)

Mysql > create user root@'%' 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): You must reset your password using ALTER USER statement before executing this statement.

Mysql > alter user root@'localhost' identified by 'oracle'

Query OK, 0 rows affected (0.07 sec)

Mysql > show variables like'% valid%pass%'

Empty set (0.01sec)

-- create a user who can log in remotely:

Mysql > create user root@'%' identified by 'oracle'

Query OK, 0 rows affected (0.06 sec)

Mysql > grant all privileges on. To root@'%' with grant option

Query OK, 0 rows affected (0.07 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Record

Decompression

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 24 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 25 10:01 mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz

[root@localhost home] #

[root@localhost home] # tar-xJvf mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz-C / usr/local/

Copy to

Root@localhost home] # mv / usr/local/mysql-8.0.12-linux-glibc2.12-x86_64/ / usr/local/mysql

[root@localhost home] #

Configuration file:

[root@localhost mysql] #

[root@localhost mysql] #

[root@localhost mysql] # cd / etc/

[root@localhost etc] # mv my.cnf my.cnf.bak

[root@localhost 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 has been written

[root@localhost etc] #

[root@localhost etc] #

[root@localhost etc] #

[root@localhost etc] #

[root@localhost etc] # mkdir-p / data/mysql

[root@localhost etc] # chown-R mysql:mysql / data/mysql/

[root@localhost etc] # chmod-R 775 / data/mysql/

[root@localhost etc] #

/ usr/local/mysql/bin/mysqld-user=mysql-basedir=/usr/local/mysql-datadir=/data/mysql-initialize-insecure

[root@localhost etc] # cat / data/mysql/error.log | grep-I password

2018-08-25T21:10:11.470522+08:00 5 [Warning] [MY-010453] [Server] root@localhost is created with an empty password! Please consider switching off the-- initialize-insecure option.

~

"profile.d/mysql.sh" [new] 2L, 69C has been written

[root@localhost etc] #

[root@localhost etc] # source / etc/profile.d/mysql.sh

[root@localhost etc] #

[root@localhost etc] # mysqld-- version

Mysqld Ver 8.0.12 for linux-glibc2.12 on x8634 (MySQL Community Server-GPL)

[root@localhost 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) 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.

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 root@'%' identified by 'admin'

Query OK, 0 rows affected (0.10 sec)

Mysql > alter user root@'localhost' identified by 'admin'

Query OK, 0 rows affected (0.05 sec)

Mysql > show variables like'% valid%pass%'

Empty set (0.01sec)

Mysql > create user root@'%' identified by 'admin'

ERROR 1396 (HY000): Operation CREATE USER failed for 'root'@'%'

Mysql > grant all privileges on. To root@'%' with grant option

Query OK, 0 rows affected (0.08 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Mysql >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report