Centos7 mysql installation
-- force-- nodeps forcibly ignore dependencies
Query whether there is a mysql:
Rpm-qa | grep-I mysql
If you show that it is installed, delete it:
Sudo yum-y remove mysql-libs*
Deleted:
Upload the mysql tar package to the server:
Create a folder:
Mkdir mysql
Decompress:
Tar-xvf mysql-5.7.22-1.el6.x86_64.rpm-bundle.tar
Start the installation:
Sudo rpm-ivh mysql-community-devel-5.7.22-1.el6.x86_64.rpm-force-nodeps
Sudo rpm-ivh mysql-community-client-5.7.22-1.el6.x86_64.rpm-force-nodeps
Sudo rpm-ivh mysql-community-common-5.7.22-1.el6.x86_64.rpm-force-nodeps
Sudo rpm-ivh mysql-community-embedded-5.7.22-1.el6.x86_64.rpm-force-nodeps
Sudo rpm-ivh mysql-community-server-5.7.22-1.el6.x86_64.rpm-force-nodeps
Sudo rpm-ivh mysql-community-embedded-devel-5.7.22-1.el6.x86_64.rpm-force-nodeps
Sudo rpm-ivh mysql-community-libs-5.7.22-1.el6.x86_64.rpm-force-nodeps
Sudo rpm-ivh mysql-community-libs-compat-5.7.22-1.el6.x86_64.rpm-force-nodeps
Startup: sudo / etc/init.d/mysqld start error report
Add package: (useless)
Numactl-2.0.11-8.fc28.x86_64
Numactl-devel-2.0.11-9.fc29.x86_64
Numactl-libs-2.0.11-9.fc29.x86_64
Installation: (useless)
Sudo rpm-ivh numactl-2.0.11-8.fc28.x86_64.rpm-force-nodeps
Sudo rpm-ivh numactl-devel-2.0.11-9.fc29.x86_64.rpm-force-nodeps
Sudo rpm-ivh numactl-libs-2.0.11-9.fc29.x86_64.rpm-force-nodeps
Start again: sudo / etc/init.d/mysqld start error
Add package: (useful for problem solving)
Libaio-0.3.107-10.el6.x86_64
Installation:
Sudo rpm-ivh libaio-0.3.107-10.el6.x86_64.rpm-force-nodeps
Third boot: sudo / etc/init.d/mysqld start error report
View the versions supported by the system glibc:
Strings / lib64/libc.so.6 | grep GLIBC_
Install gcc:
Create a new folder gcc
Mkdir gcc
Import package:
Installation:
Sudo rpm-ivh mpfr-3.1.1-4.el7.x86_64.rpm-force-nodeps
Sudo rpm-ivh libmpc-1.0.1-3.el7.x86_64.rpm-force-nodeps
Sudo rpm-ivh kernel-headers-3.10.0-862.el7.x86_64.rpm-force-nodeps
Sudo rpm-ivh glibc-headers-2.17-222.el7.x86_64.rpm-force-nodeps
Sudo rpm-ivh glibc-devel-2.17-222.el7.x86_64.rpm-force-nodeps
Sudo rpm-ivh cpp-4.8.5-28.el7.x86_64.rpm-force-nodeps
Sudo rpm-ivh gcc-4.8.5-28.el7.x86_64.rpm-force-nodeps
Install the remaining packages of glibc:
Import package:
Install the package:
Sudo rpm-ivh glibc-common-2.17-222.el7.x86_64.rpm-force-nodeps
Sudo rpm-ivh glibc-2.17-222.el7.x8664.rpm-force-nodeps
View the versions supported by the system glibc:
Strings / lib64/libc.so.6 | grep GLIBC
Fourth startup: sudo / etc/init.d/mysqld start successful
Change the mysql root password:
Stop the service:
Sudo / etc/init.d/mysqld stop
Password-free startup:
Sudo mysqld_safe-- skip-grant-tables &
Login:
Mysql-u root-p
If the password is empty, enter directly:
Use the database:
Use mysql
Change the password:
UPDATE user SET authentication_string=PASSWORD ('root') where USER='root'
UPDATE user SET password=PASSWORD ('root') where USER='root'
Flush privileges
Exit
Restart the mysql service:
Sudo / etc/init.d/mysqld restart
Login with account password:
Mysql-u root-p
Root
Change the password:
Alter user user () identified by "! QAZ2wsx"
View the connection port:
Show global variables like 'port'
If it is 3306, no modification is required.
Second, the modification of MySQL port number
1. Edit / etc/my.cnf file [root@localhost ~] # vi / etc/my.cnf
2. Add port=2032
3. Restart mysql [root@localhost ~] # / etc/init.d/mysqld restart
Create a remote connection user and authorize:
View the current user:
Select Host,User,Password from mysql.user
Version 5.7 and above password=authentication_string
Select Host,User,authentication_string from mysql.user
Query results show that there are no remotely accessible users
Add a user:
Create user changan_test identified by 'Passw0rd'
User authorization
Grant all privileges on. To 'changan_test'@'%'identified by' Passw0rd' with grant option
Flush privileges
Grant all privileges on. To 'jira'@'%'identified by' Passw0rd*' with grant option
Flush privileges
View users:
Changantest can be accessed at any address (host)
Access attempt:
View firewall: firewall on
Turn off the firewall:
Try to connect remotely again: (connect successfully)
Create the database and execute the sql file