本文目錄一覽:
mysql修改了埠 網站需要修改嗎
MySQL是一種關係資料庫管理系統。
通常的埠號是3306,埠號可自定義修改。
在網站後台與資料庫連接的配置文件中會有配置文件,裡面會設置與資料庫連接的資料庫地址,埠號,用戶名,密碼相關項,如下圖所示:
MYSQL如果是默認埠3306,可以省略埠號。
MYSQL修改了埠,則必須要在地址後面加上埠號,只需在config配置文件中修改相應的埠即可,可正常訪問資料庫,網站正常運行,如下圖所示:
mysql埠號修改
1. 登錄mysql
[root@test /]# mysql -u root -p
Enter password:
2. 使用命令show global variables like ‘port’;查看埠號
mysql show global variables like ‘port’;
+—————+——-+
| Variable_name | Value |
+—————+——-+
| port | 3306 |
+—————+——-+
1 row in set (0.00 sec)
3. 修改埠,
編輯/etc/my.cnf文件,早期版本有可能是my.conf文件名,增加埠參數,並且設定埠,注意該埠未被使用,保存退出。
[root@test etc]# vi my.cnf
[mysqld]
port=3506
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
“my.cnf” 11L, 261C written
[root@test etc]#
4. 重新啟動mysql
[root@test ~]# systemctl restart mysqld
5.再次登錄後檢查埠已修改為』3506』.
[root@test etc]# mysql -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.66 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
mysql資料庫的埠號怎麼修改
在windows下一般是更改mysql安裝目錄的my.ini文件,把裡面那個port=3306更改你想要的埠 在Linux下,一般是更改/etc/my.cnf文件,把裡面那個port=3306更改你想要的埠 這樣更改完埠,重啟下服務就可以。這更改後的埠最好是1024後面的埠…
MySQL如何簡單的修改的埠號
先在服務里停止mysql的伺服器
再找到mysql安裝目錄下面的my.ini文件,把裡面的埠號3306替換成其它的埠號。
重啟mysql服務。
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/258051.html