<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Control WebPanel Wiki &#187; remote MySQL</title>
	<atom:link href="http://wiki.centos-webpanel.com/tag/remote-mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://wiki.centos-webpanel.com</link>
	<description>CentOS WebPanel Wiki</description>
	<lastBuildDate>Wed, 12 Feb 2025 20:38:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>How to connect MySQL database remotely</title>
		<link>http://wiki.centos-webpanel.com/how-to-connect-mysql-database-remotely</link>
		<comments>http://wiki.centos-webpanel.com/how-to-connect-mysql-database-remotely#comments</comments>
		<pubDate>Mon, 14 Mar 2022 20:11:05 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[remote MySQL]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=1791</guid>
		<description><![CDATA[How to connect MySQL database remotely - Open MySQL port 3306 or whitelist your IP in the firewall - Create remote MySQL user from MySQL manager in CWP * We recommend whitelisting IP in the firewall as it is a much safer option. Example of whitelisting IP from the command line csf -a 10.10.23.124 "mysql [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>How to connect MySQL database remotely</strong><br />
- Open MySQL port 3306 or whitelist your IP in the firewall<br />
- Create remote MySQL user from MySQL manager in CWP</p>
<p>* We recommend whitelisting IP in the firewall as it is a much safer option.<br />
Example of whitelisting IP from the command line</p>
<pre>csf -a 10.10.23.124 "mysql remote connection"</pre>
<p>Temp allow IP for 24h</p>
<pre>csf -ta 86400 10.10.23.124 "mysql remote connection"</pre>
<p>Remote MySQL user in CWP is under Host.<br />
You can choose from % Any or Specify Remote IP.</p>
]]></content:encoded>
			<wfw:commentRss>http://wiki.centos-webpanel.com/how-to-connect-mysql-database-remotely/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote MySQL with SOCAT socket</title>
		<link>http://wiki.centos-webpanel.com/remote-mysql-with-socat-socket</link>
		<comments>http://wiki.centos-webpanel.com/remote-mysql-with-socat-socket#comments</comments>
		<pubDate>Tue, 30 Jun 2015 20:50:20 +0000</pubDate>
		<dc:creator><![CDATA[publisher]]></dc:creator>
				<category><![CDATA[Clusters]]></category>
		<category><![CDATA[Load-Balancers]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[remote MySQL]]></category>

		<guid isPermaLink="false">http://wiki.centos-webpanel.com/?p=320</guid>
		<description><![CDATA[How to make a remote MySQL server with socket by using SOCAT. Remote MySQL advantages - move MySQL CPU usage from local CWP web server - move MySQL disk IO operations from disk - move MySQL disk space usage to other server - improve performances by moving MySQL to SSD multi-core powered server ... on [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>How to make a remote MySQL server with socket by using SOCAT.</strong><br />
Remote MySQL advantages<br />
- move MySQL CPU usage from local CWP web server<br />
- move MySQL disk IO operations from disk<br />
- move MySQL disk space usage to other server<br />
- improve performances by moving MySQL to SSD multi-core powered server<br />
...</p>
<p><strong>on the remote MYSQL server</strong><br />
This needs to be a clean server, best would be a clean CentOS 6 minimal without any control panel.</p>
<p>Install MySQL server and Socat</p>
<pre>yum install mysql-server socat -y</pre>
<p>Run Socat listening for MySQL on the port 3307</p>
<pre>socat TCP-LISTEN:3307,reuseaddr,fork UNIX-CONNECT:/var/lib/mysql/mysql.sock &#038;</pre>
<p><strong>on the CWP Web server</strong><br />
1. Backup all databases<br />
2. Import databases to the remote MySQL server<br />
3. Update MySQL root password from MySQL server and add it in following files:<br />
- /root/.my.cnf<br />
- /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php<br />
Update postfix<br />
- /usr/local/cwpsrv/htdocs/resources/admin/include/postfix.php<br />
** Other option would be that you change MySQL root password on the MySQL server.<br />
4. Stop local MySQL server<br />
5. Add IP from CWP server to MySQL and from MySQL to CWP in firewall allow list.</p>
<p>Please note that also in the bellow listed files you need to replace <b>$db_host</b> and <b>$db_host_postfix</b> from <b>localhost</b> to your remote mysql server ip<br />
/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php<br />
/usr/local/cwpsrv/htdocs/resources/admin/include/postfix.php</p>
<p>Now lets create remote MySQL socket connection with socat (replace SERVER-IP)</p>
<pre>socat UNIX-LISTEN:/var/lib/mysql/mysql.sock,fork,reuseaddr,unlink-early,user=mysql,group=mysql,mode=777 TCP:SERVER-IP:3307 &#038;</pre>
<p>If you have successful login in the cwp and local MySQL server is stopped than this means that you are connected on the remote MySQL server.<br />
Once you have a working remote mysql server then you need to create remote mysql users root/postifx</p>
<pre>
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'postfix'@'%' IDENTIFIED BY 'old-password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'old-password';
MariaDB [(none)]> flush privileges;</pre>
<p>Disable or remove local MySQL server from web hosting server.</p>
<p><strong>For assistance you can contact our support</strong><br />
<a href="http://centos-webpanel.com/contact" title="Contact CentOS support" target="_blank">http://centos-webpanel.com/contact</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wiki.centos-webpanel.com/remote-mysql-with-socat-socket/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
