Reputation: 71
Environment: I have a database on CentOS The folder where it is saved is shared using SAMBA Windows have access to the files at \\192.168.1.101\mysql\food\ MySQL-server is running on both systems
Problem: I need to access the database on windows using mysql from CMD
Extra info: I open mysql on CMD by running: C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -h localhost -u root -p mysql>
I can not display the table on \\192.168.1.101\mysql\food\ because is not the default folder for mysql
Question: how can i change the default folder on mysql-windows to open my database? do I need something else to display the database? like add a user to mysql-server on centos and grant access
Upvotes: 2
Views: 15169
Reputation: 765
you can connect to a different host by running mysql -h 123.45.67.89. Please note that there are a few security implications:
1.You will have to grant yourself access. You will need to run something like GRANT ALL on db_name.table TO user@your_ip IDENTIFIED BY 'password'.db_name, table
and your_ip can be * but beware of opening your server to hackers.
2.ou will have to open your server's firewall if you are not on the same LAN. Again, ymmv and you should be aware not to open the door to exploits.
3.You may want to use SSL
( http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option%5Fmysql%5Fssl ) and use secure-auth
( http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option%5Fmysql%5Fsecure-auth ) in order to protect your traffic and credentials.
Hope that helps.Thanks to you
Upvotes: 2