In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
System environment: CentOS 7.6
Turn off security mechanisms such as firewalls
Check whether the system has a database installed by default
[root@mysqlmaster ~] # rpm-qa | grep mariadb
Mariadb-libs-5.5.56-2.el7.x86_64
Uninstall the default database
[root@mysqlmaster] # rpm-e mariadb-libs-5.5.56-2.el7.x86_64-- nodeps
Download precompiled binary package
[root@mysqlmaster ~] # wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
Decompression package
[root@mysqlmaster] # tar fx mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz-C / usr/local
Rename mysql or create a soft connection
[root@mysqlmaster ~] # mv / usr/local/mysql-5.7.18-linux-glibc2.5-x86_64/ / usr/local/mysql
Create a soft connection (no need to create a soft connection if renamed)
[root@mysqlmaster] # ln-s / usr/local/mysql-5.7.18-linux-glibc2.5-x86_64/ / usr/local/mysql
Create users and groups
[root@mysqlmaster ~] # groupadd mysql
[root@mysqlmaster] # useradd-r-g mysql mysql
Write a configuration file for mysql
[root@mysqlmaster ~] # vim / etc/my.cnf
[mysqld]
Datadir=/usr/local/mysql/data
Socket=/usr/local/mysql/mysql.sock
Symbolic-links=0
[mysqld_safe]
Log-error=/usr/local/mysql/logs/error.log
Pid-file=/usr/local/mysql/mysql.pid
[client]
Socket=/usr/local/mysql/mysql.sock
Immediately after the configuration file is written, create the path mentioned in the configuration file.
[root@mysqlmaster] # mkdir-p / usr/local/mysql/data
[root@mysqlmaster] # mkdir-p / usr/local/mysql/logs
[root@mysqlmaster ~] # touch / usr/local/mysql/logs/error.log
Authorization
[root@mysqlmaster] # chown-R mysql.mysql / usr/local/mysql/
[root@mysqlmaster] # chown-R mysql.mysql / etc/my.cnf
Installation
[root@mysqlmaster] # / usr/local/mysql/bin/mysqld-initialize-insecure-user=mysql-basedir=/usr/local/mysql/-datadir=/usr/local/mysql/data/
Do some extra security reinforcement.
[root@mysqlmaster] # / usr/local/mysql/bin/mysql_ssl_rsa_setup-- basedir=/usr/local/mysql/-- datadir=/usr/local/mysql/data/
Copy startup script
[root@mysqlmaster ~] # cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld
Modify a file
[root@mysqlmaster] # sed-I '46c basedir=/usr/local/mysql' / etc/init.d/mysqld
[root@mysqlmaster ~] # sed-I '47c datadir=/usr/local/mysql/data' / etc/init.d/mysqld
[root@mysqlmaster ~] # sed-I '63c mysql_pid_file_path=/usr/local/mysql/data/mysqld.pid' / etc/init.d/mysqld
Start the database
[root@mysqlmaster ~] # / etc/init.d/mysqld start
Database started successfully!
Set up a soft connection to facilitate startup
[root@mysqlmaster] # ln-s / usr/local/mysql/bin/* / usr/local/sbin/
Change the password (five interactive high-end change password), and log in successfully!
[root@mysqlmaster] # mysql-e "use mysql;alter user 'root'@'localhost' identified by' 123456;"
[root@mysqlmaster] # mysql-uroot-p123456
Join systemctl to manage
Cat > / usr/lib/systemd/system/mysqld.service
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.