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

MySQL 8.0.13 binary installation

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

MySQL 8.0 binary installation is roughly similar to MySQL 5.7

1. Delete the original mysql by query

Use rpm-qa | grep mysql or mariadb to search for mysql, and if present, use rpm-e-- nodeps mariadb-* to delete all

Or delete all using yum remove mysql mysql-server mysql-libs compat-mysql51

two。 Download the required dependency package

Yum remove libnuma.so.1

Yum install make cmake libaio wget-y

Yum install numactl.x86_64

Yum install gcc gcc-c++ automake

CMake http://www.cmake.org

GNU make http://www.gnu.org/software/make/

Bost http://nchc.dl.sourceforge.net/project/boost/boost

Bison http://ftp.gnu.org/gnu/bison/

Ncurses http://ftp.gnu.org/gnu/ncurses/

3. Get MySQL

The address can be found on MySQL's official website.

Wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz

4. Create MySQL user groups and users

/ usr/sbin/groupadd mysql

/ usr/sbin/useradd-g mysql mysql

5. Decompress to / usr/local

Tar xvf mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz-C / usr/local/

Change its name to mysql

Mv mysql-8.0.13-linux-glibc2.12-x86_64/. / mysql

Authorization

Chown mysql:mysql. / *

6. Create MySQL data directory, log directory

Mkdir / usr/app

Mkdir / usr/app/mysqdata

Mkdir / usr/app/mysqllog

Modify file permissions

Chown-R mysql:mysql / usr/app

Initialize the database under / usr/usr/mysql directory

Bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql-datadir=/usr/app/mysqldata

Record the last line root@localhost: OkYQ (U > p34G & root temporary password generated by mysql

Ssl verifies bin/mysql_ssl_rsa_setup-datadir=/usr/app/mysqldata

8. Create a profile

Vi / etc/my.cnf

[mysqld]

# General configuration options

User=mysql

Port=3306

Server_id=1

Basedir= / usr/local/mysql

Datadir= / usr/app/mysqldata

Character_set_server=utf8

Pid_file=/usr/app/mysqldata/mysql.pid

# socket = / var/run/mysqld/mysqld.sock

# error Log

Log_error= / usr/app/mysqldata/myerror.log

# slow log

Slow_query_log=1

Slow_query_log_file=/usr/app/mysqllog/mysql.slow

Long_query_time=5

# bin_log Log

Log_bin=/usr/app/mysqllog/mysql_bin

Skip_external_locking

Skip_name_resolve

# enable independent tablespaces

Innodb_file_per_table = on

[mysql]

No-auto-rehash

# socket = / var/run/mysqld/mysqld.sock

# default-character-set=utf8

# safe-updates

[client]

Loose-default-character-set = utf8

9. Configure mysqld

Cp mysql.server / etc/init.d/mysqld

Vim / etc/init.d/mysqld # # modify basedir= 's own path modify datadir= 's own path

10. Start the mysql service

Mkdir-p / var/run/mysqld

Chown mysql:mysql / var/run/mysqld

/ usr/local/mysql/bin/mysqld_safe-defaults-file=/etc/my.cnf &

11.ps-ef | grep mysql can see a message similar to the following, indicating that the startup is successful

Root 4578 10 15:16 pts/0 00:00:00 / bin/sh / usr/local/mysql/bin/mysqld_safe-- datadir=/usr/app/mysqldata-- pid-file=/usr/app/mysqldata/bogon.pid

Mysql 4865 4578 0 15:16 pts/0 00:00:11 / usr/local/mysql/bin/mysqld-basedir=/usr/local/mysql-datadir=/usr/app/mysqldata-plugin-dir=/usr/local/mysql/lib/plugin-user=mysql-log-error=/usr/app/mysqldata/myerror.log-pid-file=/usr/app/mysqldata/bogon.pid-socket=/var/run/mysqld/mysqld.sock-port=3306

Root 5839 1022 0 15:35 pts/0 00:00:00 grep-color=auto mysql

twelve。 Add environment variabl

Echo "export PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile

Source / etc/profile

13. Connection login

Mysql-u root-p

If you can't connect, add the-S parameter

Mysql-uroot-p-S / var/run/mysqld/mysqld.sock

Change the password:

Alter user 'root'@'localhost' identified by' 123456'

Flush privileges

Exit restart kill the mysql process, and then start

/ etc/init.d/mysqld start

14. Add boot boot

Chmod + x / etc/init.d/mysqld

Chkconfig-add mysqld

Chkconfig mysqld on

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