日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

支持外网访问的CentOS云数据库搭建

發布時間:2023/12/20 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 支持外网访问的CentOS云数据库搭建 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

全程root權限下操作

華為云主機環境(云主機ip為:xx.xxx.xx.xx):

Linux CentOS6 2.6.32-696.16.1.el6.x86_64?

云主機mysql版本:

Server version: 5.1.73 Source distriution

首先確保使用的端口9999在云主機的控制臺(工程師對于控制臺不一定有操作權限,必須是購買云主機的人才有操作權限)上已經被打開,否則下面操作無效。

好,接下來開始改配置

vim /etc/my.cnf

[mysqld] #修改為你想要改的端口 port=9999 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/run/mYsqld/mysqld.pid

service mysqld restart


在云主機的終端下檢查下有效果:

[root@SI235ODF23J234IO etc]# netstat -antp |grep 9999
tcp? ? ? ? 0? ? ? 0 0.0.0.0:9999? ? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? ? ? ?LISTEN? ? ? 17612/mysqld? ? ? ??
tcp? ? ? ? 0? ? ? 0 xx.yy.zz.aa:9999? ? ? ? ? ?zz.zz.z.xxx:9114? ? ? ? ? ? ESTABLISHED 17612/mysqld? ? ? ??

在云主機的數據庫中檢查下有如下效果:

mysql> show global variables like 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port? ? ? ? ? | 9999? |
+---------------+-------+
1 row in set (0.00 sec)


以上所有步驟都是云主機上操作,下滿是自己筆記本操作

接下來是最終結果驗證:

下面在自己筆記本上連接云主機:

(python2.7) appleyuchi@ubuntu:~$ mysql -h xx.xxx.xx.xx(這里填寫要連接的云主機的ip) -P 9999(必須與上面云主機開放的端口一致) -u root -p

Enter password: (這里輸入云主機上的數據庫的密碼)
Welcome to the MySQL monitor.? Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution


Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> show databases;
+--------------------+
| Database? ? ? ? ? ?|
+--------------------+
| information_schema |
| mysql? ? ? ? ? ? ? |
| test_appleyuchi? ? ?|
+--------------------+
3 rows in set (0.20 sec)

非常重要的參考文獻:

http://blog.itpub.net/26148431/viewspace-1466379/


總結

以上是生活随笔為你收集整理的支持外网访问的CentOS云数据库搭建的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。