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

A brief Analysis of the tutorial of setting up remote connection with oneinstack installation mysql

2025-04-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces the use of oneinstack installation mysql remote connection tutorial analysis, the article content is the author carefully selected and edited, the use of oneinstack installation mysql remote connection tutorial analysis has a certain pertinence, for everyone's reference significance or relatively large, the following with the author to understand the subject content bar.

oneinstack website:

oneinstack.com

== The following is divided into mysql8 version and other versions, the two cases are different.

1. Cloud host security group port open 3306 port reference document: Cloud host security group port open tutorial 2. Open iptables port 3306

If your operating system is CentOS series:

iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

service iptables save #Save iptables rules

3. database authorization

Note: Create an account remotely (account name cannot be root).

For example: add a user name of db_user, password of db_pass, authorization of %( % means all IP can connect) to db_name database all permissions, the command is as follows:

1) MySQL 8.0 version # mysql -uroot -p

MySQL [(none)]> create user db_user@'%' identified by 'db_pass';#Create user

MySQL [(none)]> grant all privileges on db_name.* to db_user@'%' with grant option; #Authorize

MySQL [(none)]> exit; #Exit the database console, especially with semicolons

Other database versions:

# mysql -uroot -p MySQL [(none)]> grant all privileges on db_name.* to db_user@'%' identified by 'db_pass';#authorization statements, especially with semicolons MySQL [(none)]> flush privileges; MySQL [(none)]> exit; #exit database console, especially with semicolons

Summary:

1.iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

2.service iptables save

3.mysql -uroot -p

4.grant all privileges on *.* to sunny@'%' identified by '123456';

5.flush privileges;

6.exit;

Explain as follows:

Open port iptables 3306.

Save iptables rules

database authorization to new user sunny, password 123456, authorization % means, all ip can connect, for all databases *.* With authority.

refresh settings

exit

If only a database is allocated, such as the oneinstack database, then *.* read oneinstack.*

If the installation is complete,

[root@bogon ~]# mysql -uroot -p

bash: mysql: command not found

[root@bogon bin]# cd ~

[root@bogon ~]# vim .bash_profile

Add:

export PATH=$PATH:/usr/local/mysql/bin

Then make it effective:

[root@bogon ~]# source .bash_profile

After reading the above tutorial analysis on using oneinstack to install mysql to set up remote connections, many readers must have some understanding, if you need to obtain more industry knowledge information, you can continue to pay attention to our industry information column.

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