<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">

<html>

<!--(==============================================================)-->
<!--(Document created with RoboEditor. )============================-->
<!--(==============================================================)-->

<head>

<title>Connecting to MySQL databases in a secure environment</title>

<!--(Meta)==========================================================-->

<meta http-equiv=content-type content="text/html; charset=windows-1252">
<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">
<meta name=generator-major-version content=0.1>
<meta name=generator-minor-version content=1>
<meta name=filetype content=kadov>
<meta name=filetype-version content=1>
<meta name=page-count content=1>
<meta name=layout-height content=1923>
<meta name=layout-width content=522>


<!--(Links)=========================================================-->

 <link rel='stylesheet' href='ensim1blue_ns.css'>
<script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">
<!--
if (navigator.appName !="Netscape")
{   document.write("<link rel='stylesheet' href='ensim1blue.css'>");}
//-->
</script>
<style type="text/css">
<!--
div.whs1 {width: 100%; }
p.whs2 {text-align: right;}
img_whs3 {border: none; width: 20px; height: 20px; float: none; border-style: none; border-style: none;}
table.whs4 {width: 98.872%; x-cell-content-align: Top; border-spacing: 0px; border-spacing: 0px;}
col.whs5 {width: 100%;}
tr.whs6 {x-cell-content-align: center; height: 22px;}
td.whs7 {width: 100%; padding-right: 10px; padding-left: 10px; background-color: #f5f5f5; border-left-style: none; border-top-style: Solid; border-right-style: none; border-bottom-style: none; border-top-width: 1px;}
tr.whs8 {x-cell-content-align: center; height: 56px;}
td.whs9 {width: 100%; padding-right: 10px; padding-left: 10px; background-color: Transparent; border-left-style: none; border-right-style: none; border-bottom-style: none;}
-->
</style>
<script type="text/javascript" language="JavaScript">
<!--
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
{
  var strNSS = "<style type='text/css'>";
  strNSS += "td.whs9 {background-color:white; }";
  strNSS +="</style>";
  document.write(strNSS);
}
//-->
</script>
<script type="text/javascript" language="JavaScript" title="BSSC Special Effects" src="ehlpdhtm.js"></script><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
<!--
function reDo() {
  if (innerWidth != origWidth || innerHeight != origHeight)
     location.reload();
}
if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
	origWidth = innerWidth;
	origHeight = innerHeight;
	onresize = reDo;
}
onerror = null; 
//-->
</script>
<style type="text/css">
<!--
  div.WebHelpPopupMenu {position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;}
-->
</style>
<script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
<script type="text/javascript" language="javascript" src="whver.js"></script>
<script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
<script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
<script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
</head>

<!--(Body)==========================================================-->


<body>

<script type="text/javascript" language="javascript1.2">
<!--
if (window.gbWhTopic)
{
	if (window.addTocInfo)
	{
	addTocInfo("Managing services\nConfiguring services\nConfiguring the MySQL server\nConnecting to MySQL databases in a secure environment");
addButton("show",BTN_TEXT,"View_contents","","","","",0,0,"","","");

	}
	if (window.writeBtnStyle)
		writeBtnStyle();

	if (window.writeIntopicBar)
		writeIntopicBar(1);

	if (window.setRelStartPage)
	{
	setRelStartPage("appliance_help.htm");

		autoSync(1);
		sendSyncInfo();
		sendAveInfoOut();
	}
}
else
	if (window.gbIE4)
		document.location.reload();
//-->
</script><!--(Generated Code)================================================-->
<!--(WARNING: DO NOT EDIT OR DELETE THIS SECTION!)==================-->

<form>


<div placeholder id="header" class="whs1">
<p align="right" class="whs2">&nbsp;<a href="javascript:window.history.back();"><img src="!skinsubfolder!/ensim1blue/prev_on.gif" alt="Go to previously viewed topic" x-maintain-ratio="TRUE" width="20px" height="20px" border="0" class="img_whs3"></a><a href="javascript:window.history.forward();"><img src="!skinsubfolder!/ensim1blue/next_on.gif" alt="Go forward to previously viewed topic" x-maintain-ratio="TRUE" width="20px" height="20px" border="0" class="img_whs3"></a></p>
</div>

<p class=BannerBase>Connecting to MySQL databases in a secure environment</p>

<p class=Base>The <a href="oh_appl_about_security_levels.htm">security 
 level</a> configured for a site defines the access and operational limits 
 for applications and files hosted on the site. When you want to connect 
 to the MySQL databases of a site, ensure that the security settings of 
 the site do not conflict with the MySQL connection settings, otherwise 
 you will be unable to connect to the databases. </p>

<p class=Base>The following sections discuss the MySQL connection settings 
 you need to configure (if you are using the command line) for different 
 security levels. </p>

<ul>
	
	<li class=kadov-p-CBulletLong><p class=BulletLong><a href="#Connecting_to_a_MySQL_database_on_a_high_security_site">Connecting 
 to a MySQL database on a high security site</a></p></li>
	
	<li class=kadov-p-CBulletLong><p class=BulletLong><a href="#Connecting_to_a_MySQL_database_on_a_3_1_compatibility_site">Connecting 
 to a MySQL database on a 3.1 compatibility site</a></p></li>
	
	<li class=kadov-p-CBulletLong><p class=BulletLong><a href="#Connecting_to_a_MySQL_database_on_a_low_security_site">Connecting 
 to a MySQL database on a low security site</a></p></li>
</ul>

<h1><a name=Connecting_to_a_MySQL_database_on_a_high_security_site>Connecting 
 to a MySQL database on a high security site</a></h1>

<p class=Base>On a high-security site, the CGI scripts, remote login services 
 (telnet, SSH), mod_perl, and mod_php services are locked into the site's 
 file system. The Site Administrator and users of the site are logged into 
 the home directory of the site and therefore cannot access system-wide 
 files.</p>

<p class=Base>When you attempt to connect to a MySQL database using the 
 command line or in your Web scripts, the high security settings cause 
 the connection to fail with an error. This is because the MySQL socket 
 file, <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>mysql.sock</B></span>, 
 required for connecting to the MySQL server, resides at the system level 
 (<span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>/var/lib/mysql/mysql.sock</B></span>) 
 and is unavailable in the site's file system. </p>

<p class=Base>To connect to the MySQL database, you need to specify the 
 IP address of the host on which the MySQL server is located and the port 
 number. </p>

<p class=Base>You need to use the following command to connect to the databases.</p>

<p class=Base
	style="margin-left: 40px;"><span style="font-family: 'Courier New', monospace; font-weight: bold;"><B>mysql 
 -h 127.0.0.1 -P 3306 -u &lt;username&gt; -p&lt;password&gt;</B></span><br>
<br>
Where:<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-h 127.0.0.1 &nbsp;</B></span>&nbsp;is 
 the IP address of the local host <span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-P 3306 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</B></span>&nbsp;is 
 the port number<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-u &lt;username&gt; </B></span>&nbsp;is 
 the user name of the Site Administrator account<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-p&lt;password&gt;</B></span> &nbsp;&nbsp;&nbsp;is 
 the password of the Site Administrator account</p>

<ul>
	
	<li style="margin-left: -20px;"
		class=kadov-p-CImportant><p class=Important><span style="font-weight: bold;"><B>Important:</B></span> 
 Ensure that you specify <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>127.0.0.1</B></span> 
 for the <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>-h</B></span> 
 option. If you specify &quot;localhost&quot; or &quot;localhost.localdomain&quot; 
 then the MySQL client library attempts to connect to the local socket, 
 <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>/var/lib/mysql/mysql.sock</B></span>. 
 This will result in an error. <br>
	<br>
	Further, ensure that you do not leave a space between the <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>-p</B></span> 
 option and the password. Leaving a space implies that the password is 
 the database name.</p></li>
</ul>

<h1><a name=Connecting_to_a_MySQL_database_on_a_3_1_compatibility_site>Connecting 
 to a MySQL database on a 3.1 compatibility site</a></h1>

<p class=Base>On a 3.1 compatibility site, the remote login services (telnet, 
 SSH) are locked into the site's file system. The Site Administrator and 
 users of the site are logged into the home directory of the site and therefore 
 cannot access system-wide files.</p>

<p class=Base>When you attempt to connect to a MySQL database using the 
 command line or in your Web scripts, the 3.1 compatibility settings cause 
 the connection to fail with an error. This is because you are not authorized 
 to access the MySQL socket file, <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>mysql.sock</B></span> 
 (required for connecting to the MySQL server) that resides at the system 
 level (<span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>/var/lib/mysql/mysql.sock</B></span>). 
 </p>

<p class=Base>To connect to the MySQL database, you need to specify the 
 IP address of the host on which your MySQL server is located and the port 
 number. </p>

<p class=Base>You need to use the following command to connect to the databases.</p>

<p class=Base
	style="margin-left: 40px;"><span style="font-family: 'Courier New', monospace; font-weight: bold;"><B>mysql 
 -h 127.0.0.1 -P 3306 -u &lt;username&gt; -p&lt;password&gt;</B></span><br>
<br>
Where:<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-h 127.0.0.1 &nbsp;</B></span>&nbsp;is 
 the IP address of the local host <span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-P 3306</B></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is 
 the port number<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-u &lt;username&gt; </B></span>&nbsp;is 
 the user name of the Site Administrator account<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-p&lt;password&gt;</B></span> &nbsp;&nbsp;&nbsp;is 
 the password of the Site Administrator account</p>

<ul>
	
	<li style="margin-left: -20px;"
		class=kadov-p-CImportant><p class=Important><span style="font-weight: bold;"><B>Important:</B></span> 
 Ensure that you specify <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>127.0.0.1</B></span> 
 for the <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>-h</B></span> 
 option. If you specify &quot;localhost&quot; or &quot;localhost.localdomain&quot; 
 then the MySQL client library overrides this and attempts to connect to 
 the local socket, /<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B>var/lib/mysql/mysql.sock</B></span>. 
 This will result in an error. <br>
	<br>
	Further, ensure that you do not leave a space between the <span style="font-weight: bold; font-family: 'Courier New', monospace;"><B>-p</B></span> 
 option and the password. Leaving a space implies that the password is 
 the database name.</p></li>
</ul>

<h1><a name=Connecting_to_a_MySQL_database_on_a_low_security_site>Connecting 
 to a MySQL database on a low security site</a></h1>

<p class=Base>A low security site provides unrestricted access (except 
 for access restricted by file or directory permissions) to files on the 
 WEBppliance server. Since the security settings do not impose access or 
 operational limits, you can connect to the MySQL databases using the MySQL 
 socket file, <span style="font-family: 'Courier New', monospace; font-weight: bold;"><B>/var/lib/mysql/mysql.sock</B></span>. 
 Since this is the default mode of connection, you do not have to set the 
 port number and the IP address of the host name on which the databases 
 are located. </p>

<p class=Base>You need to use the following command to connect to the databases.</p>

<p class=Base
	style="margin-left: 40px;"><span style="font-family: 'Courier New', monospace; font-weight: bold;"><B>mysql 
 -u &lt;username&gt; -p&lt;password&gt;</B></span><br>
<br>
Where:<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-u &lt;username&gt;</B></span> &nbsp;is 
 the user name of the Site Administrator account<span style="font-family: 'Courier New', monospace; font-weight: bold;"><B><br>
-p&lt;password&gt; &nbsp;</B></span>is 
 the password of the Site Administrator account</p>

<p class=Base>
<a href="javascript:void(0);" onClick="var e; if (parseInt(navigator.appVersion)>=4){e=event;}  if (parseInt(navigator.appVersion) >=2 && typeof(PopupMenu_Invoke) == 'function') PopupMenu_Invoke(e,'','Changing your MySQL password','oh_appl_mysql_change_password.htm','Connecting to the PhpMyAdmin MySQL interface','oh_appl_connect_mysql.htm','Introduction to MySQL databases','oh_appl_about_mysql_mgr.htm');return false;" title="Related Topics"><img src="ss_btn_related_topics0.gif" border=0 height=16 width=92 alt="Related Topics"></a>


 </p>

<div placeholder id="footer" class="whs1">
<!--(Table)=========================================================-->
<table x-use-null-cells cellspacing="0" width="98.872%" class="whs4">
<col class="whs5">

<tr valign="middle" class="whs6">
<td colspan="1" rowspan="1" bgcolor="#F5F5F5" width="100%" class="whs7">
<p class=FooterProjectTitle
	style="text-align: right;"
	align=right><a href="javascript:window.history.back();"><img src="!skinsubfolder!/ensim1blue/prev_on.gif" alt="Go to previously viewed topic" x-maintain-ratio="TRUE" width="20px" height="20px" border="0" class="img_whs3"></a><a href="javascript:window.history.forward();"><img src="!skinsubfolder!/ensim1blue/next_on.gif" alt="Go forward to previously viewed topic" x-maintain-ratio="TRUE" width="20px" height="20px" border="0" class="img_whs3"></a></td></tr>

<tr valign="middle" class="whs8">
<td width="100%" class="whs9">
<p class=FooterProjectTitle
	style="text-align: right; font-size: 6pt;"
	align=right><input TYPE="image" &quot;&lt;img&quot; src="!skinsubfolder!/ensim1blue/print_on.gif" x-maintain-ratio="TRUE" none ; width: 36px; height: 34px; float: none ;&quot; width="36" height="34" border="0>" NAME="print1" ONCLICK="javascript:window.print()" alt="Print" style="width: 36px; height: 34px;"></p>
<p class=FooterProjectTitle
	style="text-align: right;"
	align=right>WEBppliance for Linux Appliance Administrator's Help</p>
<p class=FooterProjectTitle
	style="text-align: right;"
	align=right>Published August 20, 2003</td></tr>
</table>
</div>

<script type="text/javascript" language="JavaScript" title="WebHelpRelatedTopics"><!--
if (parseInt(navigator.appVersion) >= 3 && typeof (WritePopupMenuLayer) == "function")
  WritePopupMenuLayer();
//--></script><script type="text/javascript" language="javascript1.2">
<!--
if (window.writeIntopicBar)
	writeIntopicBar(0);
//-->
</script>
</body>

</html>
