详解如何通过SSH通道来访问MySQL


当前第2页 返回上一页

类似的,用PHP访问:

1

2

3

4

5

6

7

8

9

<?php

$smysql = mysql_connect( "127.0.0.1:3307", "dbuser", "PASS" );

mysql_select_db( "db", $smysql );

?>

Making It A Daemon

A quick and dirty way to make sure the connection runs on startup and respawns on failure is to add it to /etc/inittab and have the init process (the, uh, kernel) keep it going.

Add the following to /etc/inittab on each client:

sm:345:respawn:/usr/bin/ssh -Ng -L 3307:127.0.0.1:3306 myuser@remotehost.com

And that should be all you need to do. Send init the HUP signal ( kill -HUP 1 ) to make it reload the configuration. To turn it off, comment out the line and HUP init again.

以上就是详解如何通过SSH通道来访问MySQL的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

详解mysql 联合查询 (in和exists区别)

mysql语句查询用户权限过程详解

mysql中关于主从数据库同步延迟的问题解决

mysql数据库输入密码后闪退怎么办

通过mysql 转换null数据方法

mysql notifier是什么?

怎么使用navicat连接mysql

navicat for mysql出现1064错误怎么办

mysql内存不足怎么办

mysql优化的几种方法

更多相关阅读请进入《SSH》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...