Help

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

查看MySQL数据库地址、端口、服务器属性命令

Avatar
Administrator
  1. mysql查看数据库位置的语法: show variables like 'datadir';

     

     

    如何查看mysql数据库存放位置
  2. 命令行模式下登录到mysql

    如何查看mysql数据库存放位置
  3. 键入指令:

     

    如何查看mysql数据库存放位置
  4. 确认指令无误,回车执行,即可看到数据库存放位置

     

    如何查看mysql数据库存放位置
  5. 方法二:在mysql配置文件中查看

    如何查看mysql数据库存放位置
    END

---

The SQL query SHOW VARIABLES WHERE Variable_name = 'hostname' will show you the hostname of the MySQL server which you can easily resolve to its IP address.

SHOW VARIABLES WHERE Variable_name = 'port' Will give you the port number.

You can find details about this in MySQL's manual: 12.4.5.41. SHOW VARIABLES Syntax and 5.1.4. Server System Variables


SHOW VARIABLES WHERE Variable_name = 'hostname' 

Variable_name | Value        |

+---------------+--------------+

| hostname      | iZ23phf5pr2ZraFa 


show variables like 'datadir';

Variable_name | Value           |

+---------------+-----------------+

| datadir       | /var/lib/mysql/ 


查看数据库地址:

select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist group by ip;

查看数据库端口:

show variables like 'port' ; 

查看服务器属性:

show variables;
Avatar
Discard