search
HomeDatabaseMysql TutorialCentos7.3 installation mysql5.7.18 rpm tutorial

This article mainly introduces the installation tutorial of mysql5.7.18 rpm for Alibaba Cloud Centos7.3. Friends who need it can refer to it. I hope it can help everyone.

Uninstall MariaDB

CentOS7 installs MariaDB by default instead of MySQL, and MySQL-related software packages are also removed from the yum server. Because MariaDB and MySQL may conflict, uninstall MariaDB first.

1. Before installing the new version of mysql, we need to uninstall the mariadb-lib that comes with the system

[root@iZwz94qazh62gk5ewl4ei2Z home]# rpm -qa | grep -i mariadb
mariadb- libs-5.5.52-1.el7.x86_64
[root@iZwz94qazh62gk5ewl4ei2Z home]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64

2 , Go to the official website of mysql to download the latest version of mysql rpm collection package: mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar

3, upload mysql-5.7.18-1.el6. x86_64.rpm-bundle.tar to the linux server, and decompress the tar package

[root@iZwz94qazh62gk5ewl4ei2Z home]# mkdir mysql
[root@iZwz94qazh62gk5ewl4ei2Z home]# tar -xf mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar -C mysql
[root@iZwz94qazh62gk5ewl4ei2Z home]# cd mysql
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# ll
total 459492
-rw-r--r-- 1 7155 31415 23618836 Mar 20 17:40 mysql-community-client-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415  335496 Mar 20 17:40 mysql-community-common-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415  3747352 Mar 20 17:40 mysql-community-devel-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 39086508 Mar 20 17:40 mysql-community-embedded-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 135869292 Mar 20 17:40 mysql-community-embedded-devel-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415  2177064 Mar 20 17:40 mysql-community-libs-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415  1723180 Mar 20 17:40 mysql-community-libs-compat-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 159060212 Mar 20 17:41 mysql-community-server-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 104881084 Mar 20 17:41 mysql-community-test-5.7.18-1.el6.x86_64.rpm

4. Use the rpm -ivh command to install

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-common-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...             ################################# [100%]
Updating / installing...
  1:mysql-community-common-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-libs-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...             ################################# [100%]
Updating / installing...
  1:mysql-community-libs-5.7.18-1.el6################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-client-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...             ################################# [100%]
Updating / installing...
  1:mysql-community-client-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-server-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...             ################################# [100%]
Updating / installing...
  1:mysql-community-server-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]#

The above packages have dependencies, execute There is a sequence.

Use the rpm installation method to install mysql. The installation path is as follows:

a 数据库目录
/var/lib/mysql/
b 配置文件
/usr/share/mysql(mysql.server命令及配置文件)
c 相关命令
/usr/bin(mysqladmin mysqldump等命令)
d 启动脚本
/etc/rc.d/init.d/(启动脚本文件mysql的目录)
e /etc/my.conf

5. Database initialization

In order to ensure that the database directory is the owner of the file and the mysql login user, If your Linux system is running the mysql service as root, you need to execute the following command to initialize

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# mysqld --initialize --user=mysql

If you are logged in and run as mysql, you can remove the --user option.

In addition, the --initialize option defaults to initialization in "safe" mode, which will generate a password for the root user and mark the password as expired. After logging in, you need to set a new password,

When using the --initialize-insecure command, the safe mode is not used and a password will not be generated for the root user.

The --initialize initialization used in the demonstration here will generate a root account password. The password is in the log file. The red area is the automatically generated password.

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# cat /var/log/mysqld.log
2017-06-05T14:30:52.709474Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-05T14:30:55.590590Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-06-05T14:30:56.000269Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-06-05T14:30:56.109868Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 960c533e-49fb-11e7-91f2-00163e089fd2.
2017-06-05T14:30:56.116186Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-06-05T14:30:56.116777Z 1 [Note] A temporary password is generated for root@localhost: :Wu?2QQutQwj

Now start the mysql database systemctl start mysqld.service (Centos7 unique startup method)

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# systemctl start mysqld.service

You can use the following two commands to stop, start and restart mysql:

Start:

Use service to start: service mysqld start
Use the mysqld script to start: /etc/inint.d/mysqld start
Use safe_mysqld to start: safe_mysqld&

Stop:

Use service to start: service mysqld stop
Use the mysqld script to start: /etc/inint.d/mysqld stop
mysqladmin shutdown

Restart:

Use service to start: service mysqld restart
Start using the mysqld script:/etc/inint.d/mysqld restart

Connect to the database

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# mysql -u root -p
Enter password :

Password input: :Wu?2QQutQwj

Modify password:

set password = password('your password');
Set remote access

grant all privileges on *.* to 'root' @'%' identified by '123456'; 
flush privileges;

Set mysql to start at boot

Add to system service:

chkconfig --add mysql

Auto start:

chkconfig mysql on

Query list:

chkconfig

Note: There is no automatic startup when neither is turned off.

Related recommendations:

How to change the password in MySQL5.7.18

About MySQL5.7.18 master-slave replication setup Detailed explanation of one master and one slave example

Share the installation and configuration tutorial of mysql5.7.18 under centos6.4 (picture and text)

The above is the detailed content of Centos7.3 installation mysql5.7.18 rpm tutorial. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
How to use MySQL functions for data processing and calculationHow to use MySQL functions for data processing and calculationApr 29, 2025 pm 04:21 PM

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

An efficient way to batch insert data in MySQLAn efficient way to batch insert data in MySQLApr 29, 2025 pm 04:18 PM

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

Steps to add and delete fields to MySQL tablesSteps to add and delete fields to MySQL tablesApr 29, 2025 pm 04:15 PM

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

How to analyze the execution plan of MySQL queryHow to analyze the execution plan of MySQL queryApr 29, 2025 pm 04:12 PM

Use the EXPLAIN command to analyze the execution plan of MySQL queries. 1. The EXPLAIN command displays the execution plan of the query to help find performance bottlenecks. 2. The execution plan includes fields such as id, select_type, table, type, possible_keys, key, key_len, ref, rows and Extra. 3. According to the execution plan, you can optimize queries by adding indexes, avoiding full table scans, optimizing JOIN operations, and using overlay indexes.

How to use MySQL subquery to improve query efficiencyHow to use MySQL subquery to improve query efficiencyApr 29, 2025 pm 04:09 PM

Subqueries can improve the efficiency of MySQL query. 1) Subquery simplifies complex query logic, such as filtering data and calculating aggregated values. 2) MySQL optimizer may convert subqueries to JOIN operations to improve performance. 3) Using EXISTS instead of IN can avoid multiple rows returning errors. 4) Optimization strategies include avoiding related subqueries, using EXISTS, index optimization, and avoiding subquery nesting.

How to configure the character set and collation rules of MySQLHow to configure the character set and collation rules of MySQLApr 29, 2025 pm 04:06 PM

Methods for configuring character sets and collations in MySQL include: 1. Setting the character sets and collations at the server level: SETNAMES'utf8'; SETCHARACTERSETutf8; SETCOLLATION_CONNECTION='utf8_general_ci'; 2. Create a database that uses specific character sets and collations: CREATEDATABASEexample_dbCHARACTERSETutf8COLLATEutf8_general_ci; 3. Specify character sets and collations when creating a table: CREATETABLEexample_table(idINT

How to uninstall MySQL and clean residual filesHow to uninstall MySQL and clean residual filesApr 29, 2025 pm 04:03 PM

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

How to rename a database in MySQLHow to rename a database in MySQLApr 29, 2025 pm 04:00 PM

Renaming a database in MySQL requires indirect methods. The steps are as follows: 1. Create a new database; 2. Use mysqldump to export the old database; 3. Import the data into the new database; 4. Delete the old database.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),