连接到远程主机从内MySQL存储过程
问题描述:
可能重复:
can I access a remote mysql server/db from a stored procedure?连接到远程主机从内MySQL存储过程
我有点新到MySQL。我想创建一个接受参数并将数据集返回给只读用户的存储例程。但是,在存储的例程中,我想建立一个新的连接(使用不同的凭据)到远程MySQL主机,并根据输入参数读取所需的值。
我想这将是这样的:
CREATE PROCEDURE procReturnsData(parameter1)
BEGIN
<connect to remote MySQL server using new credentials>
<Select col1, col2 from remoteServer.table1 Where col3 = parameter1 >
<close connection>
END
什么是实现这一目标的最佳方式是什么?
谢谢。
http://stackoverflow.com/questions/4323225/can-i-access-a-remote-mysql-server-db-from-a-stored-procedure –