CentOS installation mysql5.7 detailed tutorial

CentOS installation mysql5.7 detailed tutorial

This article shares the detailed steps of installing mysql5.7 under centOS for your reference. The specific contents are as follows

first step:

The first sentence detects whether the system comes with MySQL installed. If so, execute the second sentence to delete the system's own MySQL and its dependencies.

yum list installed | grep mysql
yum -y remove mysql-libs.x86_64

Step 2:

Add rpm source to CentOS and select the newer source. Execute the following code sentence by sentence

wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum localinstall mysql-community-release-el6-5.noarch.rpm
yum repolist all | grep mysql
yum-config-manager --disable mysql55-community
yum-config-manager --disable mysql56-community
yum-config-manager --enable mysql57-community-dmr
yum repolist enabled | grep mysql

Step 3:

Install MySQL Server

yum install mysql-community-server

Step 4:

service mysqld start

Step 5:

Check whether MySQL starts automatically and set it to start automatically

chkconfig --list | grep mysqld
chkconfig mysqld on

Step 6:

This step is very important! ! !

I don't know from which version of MySQL the default root password of MySQL is not empty. During the installation process, the default password is saved in the installation log. We need to find the default password through the installation log. After successfully logging in to MySQL with the default password, you will be forced to change the password. The modified password must be complex enough (compound MySQL's default password policy) to be successfully modified. Generally, it can contain more than 8 characters with uppercase and lowercase letters, special characters and numbers.

First find the installation log

find / -name mysqld.log

Then I found that the log file path is /var/log/mysqld.log. Then use the following command to open it and press the 'i' key to scroll up

vim /var/log/mysqld.log

The red area in the picture above is where the root password is located

Step 7:

mysql security settings

mysql_secure_installation

Enter the above command to perform the following steps

SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):<–First time running, enter the initial password you just found, you will be forced to change the password before proceeding OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorization.
Set root password? [Y/n] <– Do you want to set a password for the root user? Enter y and press Enter or press Enter directly. New password: <– Set a password for the root user. Re-enter new password: <– Enter the password you set again. Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <– Do you want to delete anonymous users? It is recommended to delete in production environment, so just press Enter... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <–Whether to prohibit root remote login, select Y/n according to your needs and press Enter. It is recommended to prohibit... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <– Do you want to delete the test database? Press Enter - Dropping test database…
… Success!
- Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <– Do you want to reload the privilege tables? Press Enter directly... Success!
Cleaning up…
All done! If you've completed all of the above steps, your MySQL
The installation should now be secure.
Thanks for using MySQL!
[root@server1 ~]#

Step 8:

Optional step. By default, MySQL under Linux is case-sensitive. You can make MySQL case-insensitive by setting the following:
1. Log in as root and modify /etc/my.cnf;
2. Under the [mysqld] node, add a line: lower_case_table_names=1
3. Restart MySQL; service mysqld restart

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to install MySQL 5.7 from source code in CentOS 7 environment
  • Tutorial on installing lnmp using yum on centos7 (linux+nginx+php7.1+mysql5.7)
  • Centos7 installation and configuration of Mysql5.7
  • Detailed tutorial on installing MySQL 5.7.20 on RedHat 6.5/CentOS 6.5
  • How to move mysql5.7.19 data storage location in Centos7
  • Centos7.5 installs mysql5.7.24 binary package deployment

<<:  Detailed example of sharedWorker in JavaScript to achieve multi-page communication

>>:  How to upload and download files between Linux server and Windows system

Recommend

Use Vue3 for data binding and display list data

Table of contents 1. Comparison with Vue2 1. New ...

Today I will share some rare but useful JS techniques

1. Back button Use history.back() to create a bro...

Demystifying the HTML 5 Working Draft

The World Wide Web Consortium (W3C) has released a...

Upgrading Windows Server 2008R2 File Server to Windows Server 2016

The user organization has two Windows Server 2008...

How to use Webstorm and Chrome to debug Vue projects

Table of contents Preface 1. Create a new Vue pro...

Some tips on speeding up the development of WeChat mini-programs

1. Create a page using app.json According to our ...

Let's talk in detail about the difference between unknown and any in TypeScript

Table of contents Preface 1. unknown vs any 2. Th...

Native JavaScript to achieve the effect of carousel

This article shares the specific code for JavaScr...

Detailed explanation of simple html and css usage

I will use three days to complete the static page...

Nginx one domain name to access multiple projects method example

Background Recently, I encountered such a problem...

Summary of MySQL lock knowledge points

The concept of lock ①. Lock, in real life, is a t...

An example of elegantly writing status labels in Vue background

Table of contents Preface optimization Extract va...

Vue+el-table realizes merging cells

This article example shares the specific code of ...