Collapse

Announcement

Collapse
No announcement yet.

MySQL Hostname

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL Hostname

    Any idea about, how to change the MySQL Hostname?

  • #2
    MySQL is database server and to connect to mysql you will need to use localhost if you are connecting through same local server. If you are connecting through remotely then use host name of server or use IP address as mysql host.

    Comment


    • #3
      To find the current MySQL hostname, you can execute the below command from within mysql prompt:

      mysql> SHOW VARIABLES WHERE Variable_name = 'hostname';

      Code:
      Your MySQL connection id is 1519219
      Server version: 5.6.38 MySQL Community Server (GPL)
      
      Copyright (c) 2000, 2017, 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 VARIABLES WHERE Variable_name = 'hostname';
      +---------------+-------------------------------+
      | Variable_name | Value                         |
      +---------------+-------------------------------+
      | hostname      | <Server Hostname>                |
      +---------------+-------------------------------+
      1 row in set (0.00 sec)


      On a cPanel/WHM server, MySQL hostname is typically localhost.. MySQL installation takes the hostname of the server when it installs, so if you change the server hostname, then MySQL hostname might also be changed with it..


      Comment

      Working...
      X