<?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>Debian Tutorials &#187; database</title>
	<atom:link href="http://www.debiantutorials.com/tag/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.debiantutorials.com</link>
	<description>Copy/Paste tutorials for Debian based Linux distros</description>
	<lastBuildDate>Tue, 27 Dec 2011 01:15:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>MySql database replication (master/slave)</title>
		<link>http://www.debiantutorials.com/mysql-database-replication-masterslave/</link>
		<comments>http://www.debiantutorials.com/mysql-database-replication-masterslave/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 23:14:27 +0000</pubDate>
		<dc:creator>aip</dc:creator>
				<category><![CDATA[Lenny]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[etch]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://www.debiantutorials.net/?p=125</guid>
		<description><![CDATA[In this tutorial we'll create a simple one-way master/slave database replication. You must have at least one master and one slave but you can use multiple slaves. Master 1. Configure master to listen on all ip addresses (pico /etc/mysql/my.cnf) #bind-address = 127.0.0.1 Comment out this line or remove it 2. Configure server id, log file [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial we'll create a simple one-way master/slave database replication. You must have at least one master and one slave but you can use multiple slaves.</p>
<p><strong>Master</strong></p>
<p>1. Configure master to listen on all ip addresses (pico /etc/mysql/my.cnf)</p>
<p><code>#bind-address            = 127.0.0.1<br />
</code><span id="more-125"></span></p>
<p><em>Comment out this line or remove it</em></p>
<p>2. Configure server id, log file location and which databases are allowed to be replicated (pico /etc/mysql/my.cnf)</p>
<p><code>server-id               = 1<br />
log_bin                 = /var/log/mysql/mysql-bin.log<br />
binlog_do_db            = {database}<br />
</code></p>
<p><em>Replace {database} with the one you would like to replicate</em></p>
<p>3. Restart MySql</p>
<p><code>/etc/init.d/mysql restart<br />
</code></p>
<p>4. Create a user and allow it to act as slave for this server (mysql -u root -p)</p>
<p><code>GRANT REPLICATION SLAVE ON *.* TO {username}@'{ip}' IDENTIFIED BY '{password}';<br />
FLUSH PRIVILEGES;<br />
</code></p>
<p><em>{username} = Your preferred username<br />
{password} = Your password<br />
{ip} = IP address of the slave system or % to allow all ip addresses</em></p>
<p>5. Show current log file and position (mysql -u root -p)</p>
<p><code>SHOW MASTER STATUS;<br />
</code></p>
<p>This will return something like this:</p>
<p><code>+------------------+----------+--------------+------------------+<br />
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |<br />
+------------------+----------+--------------+------------------+<br />
| mysql-bin.000004 |     2751 | {database}   |                  |<br />
+------------------+----------+--------------+------------------+<br />
</code></p>
<p><em>Keep the file name and position. It will be used later on the slave</em></p>
<p>6. Transfer data from the master to the slave</p>
<p>You can do this using various methods including exporting and importing using phpMyAdmin, creating a database dump from the master and import to the slave and "LOAD DATA FROM MASTER".</p>
<p><strong>Slave</strong></p>
<p>1. Configure this server to be a slave for the master MySql server (pico /etc/mysql/my.cnf)</p>
<p><code>server-id               = 2<br />
master-host             = {master_ip}<br />
master-user             = {username}<br />
master-password         = {password}<br />
master-connect-retry    = 60<br />
replicate-do-db         = {database}<br />
</code></p>
<p><em>{master_ip} = The ip of the master server<br />
{username} = The username you provided earlier on the master server<br />
{password} = The password you provided earlier on the master server<br />
{database} = The database you want to replicate</em></p>
<p>2. Restart MySql</p>
<p><code>/etc/init.d/mysql restart<br />
</code></p>
<p>3. Final configurations to make the slave replicate with the master (mysql -u root -p)</p>
<p><code>SLAVE STOP;<br />
CHANGE MASTER TO MASTER_HOST='{master_ip}', MASTER_USER='{username}', MASTER_PASSWORD='{password}', MASTER_LOG_FILE='{log_file}', MASTER_LOG_POS={log_position};<br />
SLAVE START;<br />
</code></p>
<p><em>{master_ip} = The ip of the master server<br />
{username} = The username you provided earlier on the master server<br />
{password} = The password you provided earlier on the master server<br />
{log_file} = Log file name from the master (ex. mysql-bin.000004)<br />
{log_position} = Log position from the master (ex. 2751)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/mysql-database-replication-masterslave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving databases from one MySql server to another</title>
		<link>http://www.debiantutorials.com/moving-databases-from-one-mysql-server-to-another/</link>
		<comments>http://www.debiantutorials.com/moving-databases-from-one-mysql-server-to-another/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 20:12:23 +0000</pubDate>
		<dc:creator>aip</dc:creator>
				<category><![CDATA[Lenny]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://www.debiantutorials.net/?p=106</guid>
		<description><![CDATA[1. On the source database server run the following command to export all databases: mysqldump -h localhost -u {username} -p --all-databases > database_dump.sql Replace {username} with your MySql username. You can also export a single database using this command: mysqldump -h localhost -u {username} -p {database} > database_dump.sql Replace {username} with your MySql username and [...]]]></description>
			<content:encoded><![CDATA[<p>1. On the source database server run the following command to export all databases:</p>
<p><code>mysqldump -h localhost -u {username} -p --all-databases > database_dump.sql<br />
</code></p>
<p><em>Replace {username} with your MySql username.</em><span id="more-106"></span></p>
<p>You can also export a single database using this command:</p>
<p><code>mysqldump -h localhost -u {username} -p {database} > database_dump.sql<br />
</code></p>
<p><em>Replace {username} with your MySql username and {database} with the database you are going to export.</em></p>
<p>2. Move the database_dump.sql file to your destination server. You could grab it from FTP server or put it on a public web location and use wget on the destination server to receive the file. This process it outside the scope of this tutorial.</p>
<p>3. Import the dump to the destination MySql server by running the following command:</p>
<p><code>mysql -h localhost -u {username} -p < database_dump.sql<br />
</code></p>
<p><em>Replace {username} with your MySql username.</em></p>
<p>If you are only exporting a single database, use this command instead:</p>
<p><code>mysql -h localhost -u {username} -p {database} < database_dump.sql<br />
</code></p>
<p><em>Replace {username} with your MySql username and {database} with the database you are going to export.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/moving-databases-from-one-mysql-server-to-another/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setup PostgreSQL database system</title>
		<link>http://www.debiantutorials.com/setup-postgresql-database-system/</link>
		<comments>http://www.debiantutorials.com/setup-postgresql-database-system/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 12:34:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Lenny]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[etch]]></category>
		<category><![CDATA[lenny]]></category>

		<guid isPermaLink="false">http://debiantutorials.net/setup-postgresql-database-system/</guid>
		<description><![CDATA[PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. 1. Install packages apt-get install postgresql postgresql-client 2. Create a user // Change to the postgres linux user and create [...]]]></description>
			<content:encoded><![CDATA[<p>PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness.</p>
<p>1. Install packages</p>
<p><code>apt-get install postgresql postgresql-client<br />
</code><span id="more-25"></span></p>
<p>2. Create a user</p>
<p><code>// Change to the postgres linux user and create the actual user<br />
su postgres<br />
createuser user1</code></p>
<p>// Using the default template allow the user and set password<br />
psql template1<br />
alter user aip password 'password'</p>
<p>That's actually all you need to install and create the firt user. Follow the remaining steps to allow remote access to the PostgreSQL server.</p>
<p>3. Enable TCP/IP connections to the server to be able to manage by a remote client. Edit this line in the main PostgreSQL config file (pico /etc/postgresql/7.4/main/postgresql.conf):</p>
<p><code>tcpip_socket = true<br />
</code></p>
<p><em>If managing on Windows I recommend using the <a href="http://sqlmanager.net/en/products/postgresql/manager" target="_blank">EMS SQL Manager</a></em></p>
<p>4. Allow connections from you IP address or a range (pico /etc/postgresql/7.4/main/pg_hba.conf)</p>
<p><code>host    all         all         85.234.0.0         255.255.0.0   trust<br />
</code></p>
<p><em>Using this code I enabled the 85.234.0.0/255.255.0.0 IP range to connect to the server. Make sure you allow as few IP addresses as possible.</em></p>
<p>You're all set. Make sure the port 5432 is open in all firewalls to be able to remote manage the server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/setup-postgresql-database-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
