Tutorial on installing MySQL 8.0.11 under Linux

Tutorial on installing MySQL 8.0.11 under Linux

1. Go to the official website to download the installation package

Download link: Click to open the link

https://dev.mysql.com/downloads/mysql/

If your system is 32-bit, choose the first one; if your system is 64-bit, choose the second one.

You can also download it using wget

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.11-linux-glibc2.12-i686.tar.gz

Unzip the file

tar -zxvf mysql-8.0.11-linux-glibc2.12-i686.tar.gz

2 Move the compressed package to the usr/local directory and rename the file

mv /root/mysql-8.0.11-linux-glibc2.12-i686 /usr/local/mysql

3. Create a new folder data in the MySQL root directory to store data

mkdir data

4. Create mysql user group and mysql user

groupadd mysql
useradd -g mysql mysql

5. Change the mysql directory permissions

chown -R mysql.mysql /usr/local/mysql/
 
Or chown -R mysql .
 
chgrp -R mysql .

Note the last point

6. Initialize the database

Create the mysql_install_db installation file

mkdir mysql_install_db
chmod 777 ./mysql_install_db

initialization

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data //Initialize the database

or

/usr/local/mysql/bin/mysqld --initialize --user=mysql
/usr/local/mysql/bin/mysqld --initialize --user=mysql
/usr/local/mysql/bin/mysqld (mysqld 8.0.11) initializing of server in progress as process 5826
 [Server] A temporary password is generated for root@localhost: twi=Tlsi<0O!
/usr/local/mysql/bin/mysqld (mysqld 8.0.11) initializing of server has completed

Record your temporary password:

twi=Tlsi<0O!

There is a problem here that there is no libnuma.so.1

zsh: command not found: mysqld
./bin/mysqld --initialize
./bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory

2018-04-29 17:06:30 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2018-04-29 17:06:30 [ERROR] Can't locate the language directory.

libnuma needs to be installed

yum install libnuma
yum -y install numactl
yum install libaio1 libaio-dev

Installation Files

7.mysql configuration

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

Modify the my.cnf file

vim /etc/my.cnf

[mysqld]
 basedir = /usr/local/mysql 
 datadir = /usr/local/mysql/data
 socket = /usr/local/mysql/mysql.sock
 character-set-server=utf8
 port = 3306
 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
 [client]
 socket = /usr/local/mysql/mysql.sock
 default-character-set=utf8

esc to save

:wq quit

8 Establish MySQL Service

cp -a ./support-files/mysql.server /etc/init.d/mysqld

cp mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql

Add to system services

chkconfig --add mysql
cp -a ./support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

Check whether the service is effective

chkconfig --list mysqld

9. Configure global environment variables

Edit /etc/profile file

# vi /etc/profile

Add the following two lines of configuration at the bottom of the profile file, save and exit

export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib

export PATH

Setting environment variables takes effect immediately

source /etc/profile

10. Start MySQL service

service mysql start

View initial password

cat /root/.mysql_secret

11. Log in to MySQL

mysql -uroot -p密碼

To change your password:

SET PASSWORD FOR 'root'@localhost=PASSWORD('123456'); #Replace it with your own password.

12Set up remote login

mysql>use mysql

mysql>update user set host='%' where user='root' limit 1;

Refresh permissions

mysql>flush privileges;

Then check if port 3306 is open

netstat -nupl|grep 3306

Open port 3306

firewall -cmd --permanent --add-prot=3306/tcp

Restart the firewall

firewall -cmd --reload

Summarize

The above is the tutorial on installing MySQL8.0.11 under Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Detailed installation steps for MySQL 8.0.11
  • MySQL 8.0.11 MacOS 10.13 installation and configuration method graphic tutorial
  • Detailed explanation of the idea of ​​installing mysql8.0.11 and changing the root password and connecting navicat for mysql
  • Summary of the installation process of MySql 8.0.11 and the problems encountered when linking with Navicat
  • MySQL Community Server 8.0.11 installation and configuration method graphic tutorial
  • mysql8.0.11 winx64 installation and configuration method graphic tutorial (win10)
  • MySQL 8.0.11 installation summary tutorial diagram
  • Detailed installation tutorial of mysql-8.0.11-winx64.zip

<<:  Install Jenkins with Docker and solve the problem of initial plugin installation failure

>>:  js realizes shopping cart addition and subtraction and price calculation functions

Recommend

js implements the classic minesweeper game

This article example shares the specific code of ...

JavaScript to dynamically load and delete tables

This article shares the specific code of JavaScri...

How to use ES6 class inheritance to achieve a gorgeous ball effect

Table of contents introduce Implementation steps ...

Solve the problem that Navicat cannot connect to MySQL on the Linux server

At the beginning, I felt sad. The screenshots are...

Complete example of vue polling request solution

Understanding of polling In fact, the focus of po...

Detailed explanation of using INS and DEL to mark document changes

ins and del were introduced in HTML 4.0 to help au...

Solutions to VMware workstation virtual machine compatibility issues

How to solve VMware workstation virtual machine c...

mysql8.0.23 linux (centos7) installation complete and detailed tutorial

Table of contents What is a relational database? ...

MySQL 5.7.17 winx64 installation and configuration graphic tutorial

I summarized the previous notes on installing MyS...

Detailed explanation of the 4 codes that turn the website black, white and gray

The 2008.5.12 Wenchuan earthquake in Sichuan took...

Detailed tutorial on installing MySQL 5.7.20 on RedHat 6.5/CentOS 6.5

Download the rpm installation package MySQL offic...

PHP-HTMLhtml important knowledge points notes (must read)

1. Use frameset, frame and iframe to realize mult...