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

How to install MySQL on CentOS7 server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "CentOS7 server how to install MySQL", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "CentOS7 server how to install MySQL" this article.

Yun source address of MySQL: https://dev.mysql.com/downloads/repo/yum/

The yun source address of MySQL uses the document: https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

Download the yum source for mysql

You can use ustc's source wget http://centos.ustc.edu.cn/mysql-repo/mysql57-community-release-el7-11.noarch.rpm

Wget https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm / / download yum source rpm of mysql-Uvh mysql57-community-release-el7-10.noarch.rpm / / install YumSource yum repolist all | grep mysql / / View all Yum source yum repolist enabled of mysql | grep mysql / / View the yum source of enabled mysql vim / etc/yum.repos.d/mysql-community.repo / / modify the mysql source

Enable the source for mysql5.6 and close the source for mysql5.7. Enabled=1 is enabled.

[mysql56-community] name=MySQL 5.6Community Serverbaseurl= http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[mysql57-community]name=MySQL 5.7Community Serverbaseurl= http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Install mysql

Yum install mysql-community-servermkdir / data/mysql / / create a mysql data storage folder chown mysql:mysql / data/mysql / / set the owner of the folder to mysql

Modify the database file location, but do not change the sock location, or you will have the problem of not finding sock.

Vim / etc/my.conf

Modify port number

[client] # sets the client character set. The character set used when the server logs in using mysql-umyname-p will result in garbled default-character-set=utf8mb4 [mysqld] # server port number port=53306# server character set character-set-server=utf8mb4# innodb memory, which has a great impact on performance, if it is a dedicated database server 70%-80%innodb_buffer_pool_size = maximum number of 1024M# database connections that can be set to physical memory max_connections=5000# sets the maximum number of messages transmitted at one time in network transmission. The system defaults to 4MB, the maximum is 1GBmax_allowed_packet=32M# innodb log file size, and defaults to 48Minnodb_log_file_size=128M# database file location datadir=/data/mysql

Mysql self-starting

Systemctl start mysqldsystemctl enable mysqldmysql_secure_installation

Common operation

Systemctl restart mysqld / / restart mysqlmysqladmin-u foo-p password / / change password

Create a user

Mysql-uroot-p / / Log in mysqlcreate user 'jspxcms'@'%' identified by' mypass'; / /% means you can log in to the database anywhere. Delete user: drop user myname#create user 'jspxcms'@'localhost' identified by' mypass'; / / localhost means you can only log in to the database # update user set password=password ('mypass') where user='jspxcms'; / / change password create database jspxcms; / / create database grant all on jspxcms.* to' jspxcms'@'%' on this machine / / empower flush privileges; / / refresh the system permissions table show databases; / / View database use mysql / / switch to mysql database select user,host from user; / / display user name and host show variables like 'character%'; / / display character set show variables like' collation%' Show variables like'% max_connections%'; / / display the maximum number of connections exit; / / exit

Modify the password

Mysqladmin-h 111.222.333.444-u jspxcms-p password is all the content of this article "how to install MySQL on CentOS7 Server". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report