Home Database Mysql Tutorial How to install mysql in rpm in centos

How to install mysql in rpm in centos

Jan 20, 2022 pm 01:59 PM
mysql

Method: 1. Use the "yum -y install mysql57-community-release-el7-10.noarch.rpm" command to download the rpm file; 2. Use the "yum install -y mysql-server mys" command to install it That’s it.

How to install mysql in rpm in centos

The operating environment of this tutorial: linux7.3 system, mysql8.0.22 version, Dell G3 computer.

How to install mysql in rpm in centos

1. Check whether MySQL is installed on the server

    rpm -qa|grep -i mysql
Copy after login

1.1 If so, delete it or not Continue to the next step

    yum remove mysql mysql-server mysql-libs compat-mysql51
    rm -rf /var/lib/mysql
    rm /etc/my.cnf
Copy after login

After the deletion is completed, recheck if there is any, continue to delete yum remove existing name

2. Download the MySQL RPM file

   wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
    yum -y install mysql57-community-release-el7-10.noarch.rpm
Copy after login

2.1 Install MySQL (always Y is fine)

    yum install -y mysql-server mysql mysql-deve
Copy after login

2.2 After the installation is completed, check whether the installation is successful

    rpm -qi mysql-community-server
Copy after login

3 Start the mysql service

    systemctl start  mysqld.service
Copy after login

3.1 Check the startup status

    systemctl status mysqld.service
Copy after login

How to install mysql in rpm in centos

3.2 Check the original password

    grep "password" /var/log/mysqld.log
Copy after login

How to install mysql in rpm in centos

Log in to MySQL based on your original password

    mysql -u root -p
Copy after login

4. Modify the MySQL default password

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
Copy after login

new password is the new password set for you. Note: The password setting must contain uppercase and lowercase letters, numbers and special symbols (,/';:, etc.), otherwise the configuration cannot be successful

5. Configure remote service

Execute the following command to enable remote access restrictions (note: the IP enabled by the following command is 192.168.0.1. If you want to enable all, use % instead of IP)

        grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
Copy after login

password is the password you set yourself. Then enter the following two lines of commands

        flush privileges;
        exit
Copy after login

How to install mysql in rpm in centos

6. Modify the MySQL language

First log in to mysql again, and then enter status:

How to install mysql in rpm in centos

You can see that the green arrow is not utf-8

So we exit mysql first, and then modify the file content in the my.cnf file in the etc directory

After entering the file, add four lines of code

How to install mysql in rpm in centos

The code is

    [client]
    default-character-set=utf8
    character-set-server=utf8
    collation-server=utf8_general_ci
Copy after login

After saving the changed my.cnf file, restart mysql, Then enter status to check again, and you will find the changes

How to install mysql in rpm in centos

If an error is reported after MySQL login after restarting, please use the above 3.1 to check whether the startup status of MySQL is

How to install mysql in rpm in centos

If not, please use the above 3 to start MySQL, check the startup status and then log in to MySQL to check the character format

Recommended learning: mysql video tutorial

The above is the detailed content of How to install mysql in rpm in centos. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article

Hot Article

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP's big data structure processing skills PHP's big data structure processing skills May 08, 2024 am 10:24 AM

PHP's big data structure processing skills

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

How to optimize MySQL query performance in PHP?

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

How to use MySQL backup and restore in PHP?

What are the application scenarios of Java enumeration types in databases? What are the application scenarios of Java enumeration types in databases? May 05, 2024 am 09:06 AM

What are the application scenarios of Java enumeration types in databases?

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into a MySQL table using PHP?

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

How to fix mysql_native_password not loaded errors on MySQL 8.4

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

How to use MySQL stored procedures in PHP?

Performance optimization strategies for PHP array paging Performance optimization strategies for PHP array paging May 02, 2024 am 09:27 AM

Performance optimization strategies for PHP array paging

See all articles