简体   繁体   中英

How to Connect to A MySQL DB and Get Tables Using Hostname and Credentials?

I am really sorry if this is not the right place to post this question. If it is not, please mark the thread and close it. A client sent me some files which needs to be edited and some functionalities added. But he didn't send me MySQL tables which is necessary in order to install it on my server. I have database credentials (like hostname, password and username). The host-name is something like: abcd1234.secureserver.net. Is it possible to get table structure using these information?

Thanks and regards, Abhisek

Use mysqldump with -H parameter to specify the hostname. Also use -d if you want only the structure of the tables and not the data.

The above assumes that the MySQL server is listening on the public IP. If not, then you have to login to the server and run mysqldump locally without -H .

Agree to @nikhil500.

But in some cases, the remote access of MySQL is closed for security reason. So just try telnet abcd1234.secureserver.net 3306 (change 3306 to default port if needed) see if you can success connect to this mysql without connection deny.

If you can connect it, then use

mysqldump -H abcd1234.secureserver.net --default-character-set=utf8 --opt -u$DB_USER -p$DB_PASS $DB_NAME > $YOUR_FILE

Other case, you should ask your client to execute mysqldump in his server or request an remote access setting in the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM