How Can I connect matlab with my sql in other pc
2 ビュー (過去 30 日間)
古いコメントを表示
i can connect matlab to mysql, but only in localhost. and i will try to connect the matlab to other IP, not only to local IP(127.0.0.1 or localhost).
0 件のコメント
回答 (1 件)
Piyush Kumar
2024 年 10 月 30 日
Hi,
To connect MATLAB to a MySQL database on another PC, you’ll need to ensure a few things are set up correctly.
1. Find the ip-address of machine from where you want to connect.
2. In the MySQL server configuration, add the following and restart the mysql server to apply these changes.
% my.cnf file
[mysqld]
bind-address = <ip-address-of-client-machine>
3. Granting Access: Granting access to a user from a remote host.
GRANT ALL PRIVILEGES ON *.* TO 'username'@'client_machine_ip' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
4. Firewall Settings: Ensure that the firewall on the remote PC allows incoming connections on the MySQL port (default is 3306).
5. MATLAB Connection: Use the database function in MATLAB to connect to the remote MySQL server. Replace 'remote_ip' with the IP address of the remote PC:
conn = database('your_database_name', 'username', 'password', 'Vendor', 'MySQL', 'Server', 'remote_ip', 'PortNumber', 3306);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Database Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!