开发者

Execute Shell command over MySql on remote host

开发者 https://www.devze.com 2023-03-28 16:43 出处:网络
Is it possible to login into a remote mys开发者_运维百科ql machine and execute commands using \'system\' on the remote machine.

Is it possible to login into a remote mys开发者_运维百科ql machine and execute commands using 'system' on the remote machine. I can log into the remote machine, but commands using: 'system' are executed at my local machine. Thanks indeed!

I using mysql to connect from 'Host1' to 'Host2' using the command

mysql -uUsername -p data_base_name -h Host2

When I execute

'system hostname' 

after I'm connected i get.

'Host1'


I cannot log into my remote host using ssh. I don't know why. I need to do some log analysis and the only option I have is to connect to that machine using mysql. I can connect to that machine! –

As far as I know, this is definitely not possible. It's far beyond the scope of mySQL, and there would be immense security implications if it were.

I don't think there is an alternative to getting SSH (or some other service that might help) running again.


Consider doing a select into outfile and writing script code into a place that will be executed on the server. For example, if mysql is running as root on the server, you be able to add something to the /etc/rc2.d which will get executed on the server during boot time.

Alternatively, if there is a file which is used as a source for scheduling tasks you may be able to overwrite that again using "select into outfile."


system runs local commands on your box. If you need to do anything with logs, either contact your hoster, to provide a way to download them or access them.

0

精彩评论

暂无评论...
验证码 换一张
取 消