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

Detailed steps for Linux remote deployment of MySQL database

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

Share

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

Linux remotely deploys MySQL database for your reference. The details are as follows

1.0 install yum install lrzsz-y command (import external package plug-in (downloaded and ignore))

1.1 copy the mysql package to the / usr/local file directory for decompression:

1.2 decompress the imported Mysql package, enter: tar-zxvf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz command

1.3 after the decompression is completed, change the name of the extracted file to: mysql input: mv mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz mysql command to change the file name

1.4 Uninstall the linux system with mysql (with incomplete plug-ins)

View: rpm-qa | grep mysql

If you don't go straight to the next step,

Uninstall: yum remove mysql mysql-server mysql-libs

Enter: rpm-qa | grep mysql command to check again and nothing shows that it has been deleted.

If the uninstall is not successful, enter the rpm-e-- nodeps mysql-libs-5.1.71-1.el6.x86_64 command to force the uninstall

1.5 create user groups and users

Create a user group: groupadd mysql

Create user: useradd-r-g mysql mysql

Assigning proprietary user groups and users to mysql users

First create a data folder and go to the mysql file directory to create a data folder

Cd / usr/local/mysqlmkdir data

1.7 specify users and user groups

Cd / usr/local/chown-R mysql mysql/chgrp-R mysql mysql/

1.8 initialize mysql

Cd / usr/local/mysql/binyum-y install numactl

/ mysqld-- initialize-- user=mysql-- basedir=/usr/local/mysql/-- datadir=/usr/local/mysql/data/-- lc_messages_dir=/usr/local/mysql/share-- lc_messages=en_US

Remember the generated temporary mysql password

If you forget your password or want to reinitialize, you can delete the files in the mysql/data directory before executing the initialization command.

1.9 configure my.cnf

Enter: vi / etc/my.cnf command to enter the configuration file

[mysqld] basedir=/usr/local/mysql/ datadir=/usr/local/mysql/data/

Copy this information into the configuration file and press I to edit it.

Press the ESC button after editing and then press Shift +; enter wq to save and exit

2.0 start MySQL

Cd / usr/local/mysql/bin./mysqld_safe-- user=mysql &

2.1 set Boot self-boot

Cd / usr/local/mysql/support-files/cp mysql.server / etc/init.d/mysqlvi / etc/init.d/mysql

Add the mysql directory in the location below the figure

The following figure shows the save exit after being added.

Authorization: chmod + x / etc/init.d/mysql

Set to boot: chkconfig-- add mysql

2.2 start the service

Start the service: service mysql start

Stop service: service mysql stop

Restart the service: service mysql restart

View Service: service mysql status

2.3 Log in to MySQL

Enter the bin directory: cd / usr/local/mysql/bin

Log in to:. / mysql-u root-p

Change password, login authorization, authorization effective command

Change the password: set password=password ("root"); change the password to root

Login authorization: grant all privileges on *. * to'root' @'% 'identified by' root'

Authorization takes effect: flush privileges

2.4 testing Windows Link Linux system mysql Database with Navicat

Don't panic if you fail to display the link! It must be that the firewall did not open port 3306 to set

2.5 Open Firewall profile

Enter the firewall configuration file vi / etc/sysconfig/iptables

Add a line:-A RH-Firewall-1-INPUT-m state-- state NEW-m tcp-p tcp-- dport 3306-j ACCEPT opens port 3306

Just save and exit.

Then restart the firewall service iptables restart

Then do a connection test:

It will show that the connection is successful and can be used freely.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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