執行環境: oracle linux server release 6.4
mysql ver 14.14 distrib 5.1.66
1. 登入mysql
[root@test /]# mysql -u root -p
enter password:
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 92
server version: 5.1.66 source distribution
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>
2. 使用命令show global variables like 'port';檢視埠號
mysql> show global variables like 'port';
+---------------+-------+
| variable_name | value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.00 sec)
[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 ~]# /etc/init.d/mysqld restart
stopping mysqld: [ ok ]
starting mysqld: [ ok ]
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
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 global variables like 'port';
+---------------+-------+
| variable_name | value |
+---------------+-------+
| port |
3506|
+---------------+-------+
1 row in set (0.00 sec)
mysql>
總結:注意修改的埠不要被占用,而且要有規劃,不要輕意的總是調整資料庫埠。還有就是安全保障,記得與負責網路的人提前通知,以免埠無法正常使用。
MYSQL修改埠號
系統 windows server 2016 mysql版本 5.7.20 1 開啟mysql根目錄檢視是否存在my.ini,若不存在,建立乙個my.ini檔案 複製下面的code到my.ini中 client port 2512 default character set utf8 mysqld ...
mysql 修改埠 MYSQL修改埠號
系統 windows server 2016 mysql版本 5.7.20 1 開啟mysql根目錄檢視是否存在my.ini,若不存在,建立乙個my.ini檔案 複製下面的code到my.ini中 client port 2512 default character set utf8 mysqld ...
修改埠號
修改埠號 在預設情況下,tomcat的埠是8080,使用了兩個tomcat,那麼就需要修改其中的乙個的埠號才能使得兩個同時工作。那麼,如何修改tomcat的埠號呢?首先到安裝目錄 或者解壓目錄 下找到conf資料夾,在裡面找到server.xml的檔案,找到 將port 8080 改為其它的就可以了...