Centos 64-bit Linux7.5 Install mysql8.0.13 tutorial

Note in advance:

1: I have to check myself every day. Is the firewall off? If you install MySQL, you may not be able to connect to it for a long time. Did you notice the space? Have you paid attention to version details (larger versions are generally less demanding)?

2: Tutorial environment:

Mysql8.0.13 (centos Linux 7.5.1804 (core)) mysql8.0.13 (tar. Xz)

Computer operating system Win10

3: details baidu can, generally according to the tutorial problem is not big, this is the latest version of the tutorial, so pay attention to the version of the problem.

4: firewall related commands (for Ali Cloud and Tencent Cloud, it is necessary to set the security group open port in the instance control panel)

View [root@localhost ~]# systemctl status Firewalld disable [root@localhost ~]# systemctl stop Firewalld disable automatic startup upon startup [root@localhost ~]# systemctl disable firewalld Enable firewalld upon startup [root@localhost ~]# systemctl enable firewalldCopy the code

 

Tutorial start — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — (installation directory can modify) — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — – ————————– –

Preliminary instructions: /usr/local/mysqldb /usr/local/mysqldb /usr/local/mysqldb /usr/local/mysqldb /usr/local/mysqldb Must install in the custom path of the heart just comfortable, principle almost in fact, well, not worded (can use xSHlle and information XFTP tool operation as far as possible without command).

1: Create a directory and upload the installation package (for example, /opt/software/MySQL).

2: Check the default installation of 7.5:

[root@localhost ~]# rpm -qa | grep mariadb
Copy the code

Mariadb-libs-5.5.56-2.el7.x86_64 is not the same as mariadb-libs-5.5.56-2.el7.x86_64 is not the same as mariadb-libs-5.5.56-2.el7.x86_64 is not the same as mariadb-libs-5.5.56-2.el7.x86_64.

[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
Copy the code

4: Installation dependencies:

[root@localhost ~]# yum install libaio
Copy the code

5: Authorizes the installation directory

[root@localhost ~]# chmod -R 777 /opt/software/MySQL
Copy the code

6: Go to the installation package directory and decompress the package

[root@localhost ~]# cd /opt/software/MySQL
Copy the code
root@localhost MySQL]# xz -d mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz
Copy the code

After the command is executed, continue decompressing

[root@localhost MySQL]# tar -xvf mysql-8.0.13-linux-glibc2.12-x86_64.tar
Copy the code

/opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL /opt/software/MySQL

[root@localhost MySQL]# chmod -R 777 /opt/software/MySQL/mysql
Copy the code

8: Create the database storage path (manual for FXTP) and authorize it

[root@localhost MySQL]# chmod -R 777 /opt/software/MySQL/mysqldb
Copy the code

9: Create a user group

[root@localhost MySQL]# groupadd mysql
Copy the code

10: a user who can’t log in (I’m not sure why)

[root@localhost MySQL]# useradd -r -g mysql -s /bin/false mysql
Copy the code

11: Add to a user group:

[root@localhost MySQL]# chown -R mysql:mysql ./
Copy the code

12: Enter/etc (create my.cnf, FTP)

Configuration file, the content is as follows, pay attention to the two roadbed (installation software path and database storage path) for their own installation path

[mysqld] port = 3306 # # set port 3306 set of mysql installation directory basedir = / opt/software/mysql/mysql # set the mysql database data storage directory Datadir = / opt/software/MySQL/mysqldb # allows maximum number of connections max_connections = 10000 # allows the number of connection fails. Max_connect_errors =10 # The default character set used by the server is UTF8 character-set-server= UTF8 # The default storage engine to be used when creating new tables Default_authentication_plugin =mysql_native_password default_authentication_plugin=mysql_native_password [mysql] # default character set=utf8 [client] # default character set=utf8 [client default-character-set=utf8Copy the code

13: Go to the bin directory

[root@localhost MySQL]# cd /opt/software/MySQL/mysql/bin
Copy the code

Run the following command.

[root@localhost bin]#./mysqld --initialize --console error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory: apt-get install numactl apt-get install libaio-devCopy the code

(root@localhost: 7gsa9s,,1#,S)

14: to enter

[root@localhost bin]# cd /opt/software/MySQL/mysql/support-files
Copy the code

15: start (execution generally will report the following two errors, don’t worry) :

[root@localhost support-files]# ./mysql.server start
Copy the code

The solution

[root@localhost support-files]# CD /usr/bin [root@localhost bin]# sudo ln -s /opt/software/MySQL/mysql/bin/my_print_defaults [root@localhost bin]#chmod -R 777 /opt/software/MySQL/mysqldbCopy the code

16: [root@localhost ~]# service mysqld status [root@localhost ~]# service mysqld status Check whether it is enabled, because the tutorial is not over yet, it is best to test whether the startup is successful after the end! , the command is

[root@localhost bin]# cd /opt/software/MySQL/mysql/support-files
[root@localhost support-files]# cp mysql.server /etc/init.d/mysqld
Copy the code

MySQL is not running, MySQL is not running, MySQL is not running, MySQL is not running Do not use service mysql when starting this error, but PID file exists Start, because the startup is not started in this way, and there is a Redirecting to /bin/systemctl start. Mysql. service tells you to use /bin/systemctl start /bin/systemctl start mysql running (1605) /bin/systemctl start Mysql. service (mysql.service) :

Grant self-start directory permission command

[root@localhost supper-files]# chmod 777 /etc/rc.d/init.d/mysqld support-files]# chkconfig --listCopy the code

17: restart mysqld service restart (no configuration of environment variables in this directory to run the command)

[root@localhost support-files]# service mysqld restart
Copy the code

18: Change the random login password

Enter the directory [root @ localhost support - files] # CD/opt/software/MySQL/MySQL/bin start [root @ localhost bin] #. / MySQL -u root -pCopy the code

Enter the password (mentioned above for you to remember) : 7gsa9s,,1#,S (hand type, or copy to the bottom box of Xshell5 version should also work)

mysql> ALTER user 'root'@'localhost' IDENTIFIED BY 'root';
Copy the code

Sneak peek, view the database, execute the following SQL

mysql> show databases; Mysql > select * from 'mysql';Copy the code

The mysql8 installation tutorial is over, but don’t get too excited, there are still a few minor issues that have been resolved

19: Configuring environment variables (added in /etc/profile)

# configuration mysql environment variable export PATH = $PATH: / opt/software/mysql/mysql/binCopy the code

And put it into effect

[root@localhost etc]# source /etc/profile
Copy the code

From now on, you can execute MySQL operations in any directory (for example, switch to any directory and run the following command directly, and do not need./)

[root@localhost software]# mysql -u root -p
Copy the code

Enter the new password and write the SQL statement

20: First set to support remote login, execute the following statements

mysql> use mysql; mysql> update user set host = '%' where user = 'root' and host='localhost'; mysql> select host, user from user; mysql> FLUSH PRIVILEGES; Mysql > update user set user.Host='%'where user. user ='root'; mysql> quit;Copy the code

21: Finally restart, execute SQL, and display

[root@localhost bin]# cd /opt/software/MySQL/mysql/support-files
[root@localhost support-files]# service mysqld restart
Copy the code

Display in the console

Shutting down MySQL... SUCCESS! 
Starting MySQL. SUCCESS!
Copy the code

The mysql8 installation and connection database tutorial is complete

MySQL > delete MySQL from FTP

Tutorial end — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — – details qq1090510535 — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — zhang old man — — — — — — — — — — — —

Windows version of the tutorial

Blog.csdn.net/wozniakzhan…