Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos7 install and configure Mysql5.7

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Step 1: get the mysql YUM source

Go to the mysql official website to get the download address of the RPM package.

Https://dev.mysql.com/downloads/repo/yum/

Right-click the copy link address https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

Get the address of the rpm packet

Step 2: download and install the mysql source

Download the mysql source installation package first

[root@localhost ~] # wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

-bash: wget: command not found

Let's install wget first.

Yum-y install wget

Then execute wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

Install the mysql source

Yum-y localinstall mysql57-community-release-el7-11.noarch.rpm

Step 3: install Mysql online

Yum-y install mysql-community-server

There are more things to download. You have to wait a little while.

Step 4: start the Mysql service

Systemctl start mysqld

Step 5: set boot up

Systemctl enable mysqldsystemctl daemon-reload

Step 6: change the root local login password

After the mysql installation is complete, a temporary default password is generated for root in the / var/log/mysqld.log file.

Vi / var/log/mysqld.log

The password here is: xtqh0Neteu=7

Mysql-u root-pEnter password:

Enter a temporary password to enter the mysql command line

ALTER USER 'root'@'localhost' IDENTIFIED BY' LCode1996.'

Change the password to LCode1996. (note mysql5.7 default password policy requires that the password must be a combination of uppercase and lowercase alphanumeric special letters, at least 8 digits.)

Step 7: set up to allow remote login

Mysql does not allow remote login by default. We need to set it up, and the firewall opens port 3306.

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' LCode1996.' WITH GRANT OPTION;Query OK, 0 rows affected, 1 warning (0.05 sec) mysql > exit;Bye

Quit.

[root@localhost] # firewall-cmd-- zone=public-- add-port=3306/tcp-- permanentsuccess [root@localhost ~] # firewall-cmd-- reloadsuccess [root@localhost ~] #

Open port 3306

Step 8: configure the default encoding to UTF-8

Modify the / etc/my.cnf configuration file and add the encoding configuration under [mysqld], as follows:

[mysqld] character_set_server=utf8init_connect='SET NAMES utf8' [root@localhost ~] # vi / etc/my.cnf

Restart mysql service after editing and saving: systemctl restart mysqld

Check the code below:

Mysql > show variables like'% character%'

Step 9: test

We use the local sqlyog to remotely connect the mysql in the virtual machine.

At this point, the Mysql installation and configuration is complete

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report