This is the 21st day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021
preface
This article was written in the Mysql5.7 era, learning about either traditional projects or old projects
Uninstall old or earlier versions of Mysql
Mysql now has multiple versions such as Mariadb, please uninstall as well
Check for older or lower versions of Mysql
yum list installed grep mysql*
yum list installed grep mariadb*
Copy the code
Yum remove ‘found file name’ (but if it is not a new machine, or the version is suitable, the article can be found here)
rpm -qa |grep mysql
rpm -qa |grep mariadb
Copy the code
RPM -ev ‘found package name’
Delete mysql development header files and libraries
rm -rf /usr/lib/mysql
rm -rf /usr/include/mysql
rm -rf /var/lib/mysql
rm-rf /etc/my.cnf
Copy the code
Mysql installation
Use the default mysql version of centos
By default, older versions are displayed
yum list mysql*
Copy the code
Install the mysql mysql-devel mysql-server file that is of the same version
Yum -y install ' 'Copy the code
Install mysql community edition
The following gLIC error may occur because it is the latest version of the community
Get the YUM repository that contains mysql
Get the required YUM repository here
Click on theDownload
, in the new screenNo thanks, just start my download.
Right click copy address
Install yum Repository
rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-4.noarch.rpm
Copy the code
Mysql installation
Mysql > install mysql-community-server: yum install mysql > install mysql-community-server: yum install mysql > install mysql-community-server: yum install mysql-community-server.x86_64).
Switch between different versions
The new package contains the relationship of the old package, but needs to change the version to specify the latest version yum -y install yum-utils
Yum repolist all | grep mysql yum - config manager - disable mysql80 - community / / disable mysql80 - community yum - config - manager --enable mysql57-community // enable mysql57-communityCopy the code
\
Pay attention to
- Similar errors may occur during installation
Copy the code
The solution
Just add –force (force) and –nodeps (do not find dependencies)
You can uninstall –force instead of –nodeps
- Similar errors may occur during installation
Package: mysql-community-libs-5.6.35-2.el7.x86_64 (mysql56-community) Requires: libc.so.6(glibc2.17)(64bit)Copy the code
The cause of this error is that the installation of the current file requires clibc_2.17 support
Your Linux system does not support this version
Strings/lib64 / libc. So. 6 | grep GLIBC GLIBC version of the query support
Download the glibc source code manually compiled and installed go to www.gnu.org/software/li… Find the address of glibc you need
Tar -zxvf glibc-2.17.tar.gz CD glibc-2.17 mkdir build CD build.. /configure --prefix=/opt/glibc make-j4 make installCopy the code
- Similar errors may occur during installation
Package: mysql-community-server-5.6.35-2.el7.x86_64 (mysql56-community)
Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Copy the code
Lack of support for libstdc++
yum list libstdc++*
Install the correct libstdc++
Configuration after installation
Join startup
systemctl enable mysqld
Copy the code
Start the mysql service process
systemctl start mysqld
Copy the code
The default password
5.7 The initial password is generated in /var/log/mysqld.log during mysql installation
2018-03-18T13:13:58.214961Z 1 [Note] A temporary password is generated for root@localhost: r/0SbBmW+1Mu
Copy the code
“R /0SbBmW+1Mu” in the previous sentence is the default password, you can reset the password mysql_secure_installation
To reset your password
Perform mysql_secure_installation
Prompt for password (5.7 If there is no initial password before, press Enter)
Set root password Set the root password. Y Press Enter and enter the password
Remove anonymous users Deletes anonymous user Y
Disallow root login Remotely Disabling root login n
Remove test database and access to it
Reload privilege tables now Refresh privilege Y immediately
Forgot password
Add skip-grant-tables to [mysqld] in /etc/my.cnf if root password is forgotten
Then restart service mysqld restart
Log in to the mysql database and change the root password
test
1. Start the mysql service
Service mysqld start or /etc/init.d/mysqld start
2. Check whether port 3306 is listened to
netstat -nutlp | grep mysql
3. Login
Mysql -u root -p Enter the password
4. Remote access
Error 10038 indicates that the port on the remote server is not open.
If “host XXX is not allowed to connect mysql” is displayed, the remote access permission of the user whose host is % is abnormal and you need to modify the permission locally
If there is no user whose host is “%”, add a record whose host is % to the database user
other
-
The database directory is /var/lib/mysql
-
The configuration file is in /usr/share/mysql
-
The related commands are in /usr/bin
-
The startup script is in /etc/rc.d/init.d
-
A log error occurs after the startup fails
Can't start server : Bind on unix socket: Permission denied
Copy the code
The mysql user does not have permissions on the socket configured in /etc/my.cnf
Chown -r mysql:mysql ([mysqld] where datadir is set)
- A log error occurs after the startup fails
Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Copy the code
Mysql_install_db –user=mysql –datadir=(where datadir is set in [mysqld])
conclusion
As far as the letter is not as good, the above content is purely one’s opinion, due to the limited personal ability, it is inevitable that there are omissions and mistakes, if you find bugs or have better suggestions, welcome criticism and correction, don’t hesitate to appreciate
If you like my article, you can [follow]+[like]+[comment], your three even is my forward motivation, looking forward to growing with you ~
Source: author: ZOUZDC links: https://juejin.cn/post/7028963866063306760 re the nuggets copyright owned by the author. Commercial reprint please contact the author for authorization, non-commercial reprint please indicate the source.Copy the code