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

Install and deploy Mysql tutorials under Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The following is about the installation and deployment of Mysql tutorials under Linux. The secret of the text lies in being close to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article on installing and deploying Mysql under Linux.

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/( downloads the corresponding mysql version according to its Linux operating system version)

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

To get this, this is the rpm package of the Yum warehouse is actually a download address.

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

3: install Mysql online

Yum-y install mysql-community-server

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

4: start the Mysql service

Systemctl start mysqld

5: set boot boot

[root@localhost ~] # systemctl enable mysqld

[root@localhost ~] # systemctl daemon-reload

6: modify 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.

[root@localhost ~] # vi / var/log/mysqld.log

The temporary password here is eMV.R#mWe3ha

[root@localhost] # mysql-u root-p

Enter password:

Enter a temporary password to enter the mysql command line

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' Caofeng2012@'

Query OK, 0 rows affected (0.00 sec)

Change the password to Caofeng2012@ (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)

7: set 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' Caofeng2012@' WITH GRANT OPTION

Query OK, 0 rows affected, 1 warning (0.01 sec)

Mysql > exit

Bye

Quit.

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

Success

[root@localhost] # firewall-cmd-- reload

Success

[root@localhost ~] #

Open port 3306

8: configure default encoding to utf8

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

[mysqld]

Character_set_server=utf8

Init_connect='SET NAMES utf8'

[root@localhost ~] # vi / etc/my.cnf

Restart the mysql service after editing

[root@localhost ~] # systemctl restart mysqld

[root@localhost ~] #

Check the code below:

Mysql > show variables like'% character%'

+-+

| | Variable_name | Value |

+-+

| | character_set_client | utf8 |

| | character_set_connection | utf8 |

| | character_set_database | utf8 |

| | character_set_filesystem | binary |

| | character_set_results | utf8 |

| | character_set_server | utf8 |

| | character_set_system | utf8 |

| | character_sets_dir | / usr/share/mysql/charsets/ |

+-+

8 rows in set (0.00 sec)

9: test

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

For the above installation and deployment of Mysql tutorials under Linux, is there anything you don't understand? Or if you want to know more about it, you can continue to follow our industry information section.

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