<?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>Sebastian Mogilowskis Blog &#187; mysql</title>
	<atom:link href="http://www.mogilowski.net/lang/en-us/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mogilowski.net</link>
	<description>Just another blog about administration, linux and other stuff</description>
	<lastBuildDate>Tue, 17 Jan 2012 13:42:30 +0000</lastBuildDate>
	<language>en-us</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MySQL Workbench on Ubuntu</title>
		<link>http://www.mogilowski.net/lang/en-us/2009/11/03/mysql-workbench-on-ubuntu</link>
		<comments>http://www.mogilowski.net/lang/en-us/2009/11/03/mysql-workbench-on-ubuntu#comments</comments>
		<pubDate>Tue, 03 Nov 2009 10:58:46 +0000</pubDate>
		<dc:creator>sebastian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Workbench]]></category>

		<guid isPermaLink="false">http://www.mogilowski.net/?p=602</guid>
		<description><![CDATA[Install MySQL Workbench on Ubuntu: 1. Download the Community Edition Download the latest release from the MySQL Website. I used the 64-Bit Debian Paket for Ubuntu 9.04 it works on Jaunty (9.04) and on Karmic (9.10). 2. Installation sudo dpkg -i mysql-workbench-oss-5.1.18-1ubu904-amd64.deb 3. Use it Now you can start MySQL Workbench via your menu (Development [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="en-us">Install <a href="http://wb.mysql.com" target="_blank">MySQL Workbench</a> on Ubuntu:</span></p>
<h3><span lang="en-us">1. Download the Community Edition</span></h3>
<p><span lang="en-us">Download the latest release from the <a href="http://dev.mysql.com/downloads/workbench/5.1.html" target="_blank">MySQL Website</a>. I used the 64-Bit Debian Paket for Ubuntu 9.04 it works on Jaunty (9.04) and on Karmic (9.10).</span></p>
<h3>2. Installation</h3>
<pre>sudo dpkg -i mysql-workbench-oss-5.1.18-1ubu904-amd64.deb</pre>
<h3><span lang="en-us">3. Use it</span></h3>
<p><span lang="en-us">Now you can start MySQL Workbench via your menu (Development Section).</span></p>
<p><span lang="en-us">If you use it together with an MySQL database you may get this message:</span></p>
<pre>Couldn't load library libmysqlclient_r.so:
libmysqlclient_r.so: cannot open shared object file: No such
file or directory</pre>
<p><span lang="en-us">You have to create an symlink to your libmysqlclient.</span></p>
<pre>sudo ln -sf /usr/lib/libmysqlclient_r.so.15.0.0 /usr/lib/libmysqlclient_r.so</pre>
<p><span lang="en-us"><strong>Note:</strong> You have to replace &#8220;libmysqlclient_r.so.15.0.0&#8243; with your version (&#8220;libmysqlclient_r.so.16.0.0&#8243; for example).</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mogilowski.net/lang/en-us/2009/11/03/mysql-workbench-on-ubuntu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL command line import of file with UTF-8 encoding</title>
		<link>http://www.mogilowski.net/lang/en-us/2009/07/02/mysql-command-line-import-of-file-with-utf-8-encoding</link>
		<comments>http://www.mogilowski.net/lang/en-us/2009/07/02/mysql-command-line-import-of-file-with-utf-8-encoding#comments</comments>
		<pubDate>Thu, 02 Jul 2009 21:46:39 +0000</pubDate>
		<dc:creator>sebastian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Datenbank]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://www.mogilowski.net/?p=454</guid>
		<description><![CDATA[A Post-It note for me &#8230; Importing an UTF-8 encoded MySQL Database export file with MySQL command line interface: mysql -D databasename -h hostname -p -u db_username --default_character_set utf8 &#60; sqlfile.sql If you don&#8217;t add the &#8220;&#8211;default_character_set utf8&#8243; flag you will get very funny characters in your database]]></description>
			<content:encoded><![CDATA[<p><span lang="en-us">A Post-It note for me &#8230;</span><br />
</p>
<p><span lang="en-us">Importing an UTF-8 encoded MySQL Database export file with MySQL command line interface:</span><br />
</p>
<pre>mysql -D databasename -h hostname -p -u db_username --default_character_set utf8 &#60; sqlfile.sql</pre>
<p><span lang="en-us">If you don&#8217;t add the &#8220;&#8211;default_character_set utf8&#8243; flag you will get very funny characters in your database <img src='http://cdn.mogilowski.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </span><br />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mogilowski.net/lang/en-us/2009/07/02/mysql-command-line-import-of-file-with-utf-8-encoding/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greylisting with sqlgrey, postfix and mysql on Debian Lenny</title>
		<link>http://www.mogilowski.net/lang/en-us/2009/02/10/greylisting-with-sqlgrey-postfix-and-mysql-on-debian-lenny</link>
		<comments>http://www.mogilowski.net/lang/en-us/2009/02/10/greylisting-with-sqlgrey-postfix-and-mysql-on-debian-lenny#comments</comments>
		<pubDate>Tue, 10 Feb 2009 09:17:14 +0000</pubDate>
		<dc:creator>sebastian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mailserver]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[postgrey]]></category>
		<category><![CDATA[sqlgrey]]></category>

		<guid isPermaLink="false">http://www.mogilowski.net/?p=284</guid>
		<description><![CDATA[This article describes howto setup sqlgrey with postfix and mysql on Debian Lenny. The normal graylisting with postgrey store the whitelist in a berkeley database which needs to be replicated on a mailserver cluster. With sqlgrey you can do that replication with a mysql database. First create a Database &#8220;sqlgrey&#8221; with an user &#8220;sqlgrey&#8221; on [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="en-us">This article describes howto setup sqlgrey with postfix and mysql on Debian Lenny. </span></p>
<p><span lang="en-us">The normal graylisting with postgrey store the whitelist in a berkeley database which needs to be replicated on a mailserver cluster. With sqlgrey you can do that replication with a mysql database.</span></p>
<p><span lang="en-us">First create a Database &#8220;sqlgrey&#8221; with an user &#8220;sqlgrey&#8221; on your database server. (The tables will be created by sqlgrey.)</span></p>
<h3><span lang="en-us">1. Install sqlgrey:</span></h3>
<pre>
aptitude install sqlgrey
</pre>
<h3><span lang="en-us">2. Edit the sqlgrey configuration file:</span></h3>
<pre>
vim /etc/sqlgrey/sqlgrey.conf
</pre>
<p><span lang="en-us">Edit the database settings:</span></p>
<pre>
## Database settings
db_type = mysql
db_name = sqlgrey
db_host = YOUR_DATABASE_SERVER
db_port = default
db_user = sqlgrey
db_pass = YOUR_PASS_WORD
db_cleandelay = 1800
clean_method = sync
</pre>
<h3><span lang="en-us">4. Add sqlgrey to the postfix configuration:</span></h3>
<pre>
vim /etc/postfix/main.cf
</pre>
<p><span lang="en-us">Append the recipient restrictions:</span></p>
<pre>
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
reject_unknown_client,
reject_invalid_hostname,
check_policy_service inet:127.0.0.1:2501,
permit
</pre>
<h3><span lang="en-us">5. Restart the services:</span></h3>
<pre>
/etc/init.d/sqlgrey restart
/etc/init.d/postfix restart
</pre>
<h3><span lang="en-us">6. Controll</span></h3>
<p><span lang="en-us">Watch the content of the table &#8220;connect&#8221; it contains the sender information of every incoming mail.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mogilowski.net/lang/en-us/2009/02/10/greylisting-with-sqlgrey-postfix-and-mysql-on-debian-lenny/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Authenticate ejabberd with an mysql database</title>
		<link>http://www.mogilowski.net/lang/en-us/2009/02/04/authenticate-ejabberd-with-an-mysql-database</link>
		<comments>http://www.mogilowski.net/lang/en-us/2009/02/04/authenticate-ejabberd-with-an-mysql-database#comments</comments>
		<pubDate>Wed, 04 Feb 2009 21:26:22 +0000</pubDate>
		<dc:creator>sebastian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[ejabberd]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.mogilowski.net/?p=272</guid>
		<description><![CDATA[This is a small script to authenticate Jabber users with an external MySQL database. You can free define table and columns for username and password in the settings part of the script. The password should be stored with the ENCRYPT() function in the database. First edit the Jabber configuration file (\etc\ejabberd\ejabberd.conf) and change the authentication [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="en-us">This is a small script to authenticate Jabber users with an external MySQL database. You can free define table and columns for username and password in the settings part of the script. The password should be stored with the ENCRYPT() function in the database.</span></p>
<p><span lang="en-us">First edit the Jabber configuration file (\etc\ejabberd\ejabberd.conf) and change the authentication method:</span></p>
<pre>
{auth_method, external}.
{extauth_program, &#34;/etc/ejabberd/auth_mysql.pl&#34;}
</pre>
<p><span lang="en-us">Now create the perl script /etc/ejabberd/auth_mysql.pl with the following content and changed settings:</span></p>
<pre>
#!/usr/bin/perl

# Mysql external auth script
# Features: auth isUser and change password
# Password is an encrypted password !!

# 2009-02-04 - by Mogilowski Sebastian - http://www.mogilowski.net

# Settings
my $sDatabaseHost='SERVER';            # The hostname of the database server
my $sDatabaseUser=&#34;USER&#34;;            # The username to connect to mysql
my $sDatabasePass='PASS';            # The password to connect to mysql
my $sDatabaseName=&#34;DATABASE&#34;;            # The name of the database contain the user table
my $sUserTable=&#34;TABLE&#34;;                # The name of the table containing the username and password
my $sUsernameTableField=&#34;USERFIELD&#34;;        # The name of the field that holds jabber user names
my $sPasswordTableField=&#34;PASSWORDFIELD&#34;;    # The name of the field that holds jabber passwords

# Libs
use DBI;
use DBD::mysql;

while(1) {
my $sBuffer = &#34;&#34;;
my $readBuffer = sysread STDIN,$sBuffer,2;
my $iBufferLength = unpack &#34;n&#34;,$sBuffer;
my $readBuffer    = sysread STDIN,$sBuffer,$iBufferLength;
my ($sOperation,$sUsername,$sDomain,$sPassword) = split /:/,$sBuffer;
my $bResult;

SWITCH: {
$sOperation eq 'auth' and do {
$bResult   = 0;
$connect   = DBI-&#62;connect('DBI:mysql:'.$sDatabaseName, $sDatabaseUser, $sDatabasePass) &#124;&#124; die &#34;Could not connect to database: $DBI::errstr&#34;;
$query     = &#34;SELECT $sPasswordTableField FROM $sUserTable WHERE $sUsernameTableField='$sUsername';&#34;;
$statement = $connect-&#62;prepare($query);
$statement-&#62;execute();
while ($row = $statement-&#62;fetchrow_hashref()) {
$sCryptstring = crypt($sPassword,$row-&#62;{$sPasswordTableField});
if ($row-&#62;{$sPasswordTableField} eq $sCryptstring) {
$bResult = 1;
}
}
},last SWITCH;

$sOperation eq 'setpass' and do {
$connect   = DBI-&#62;connect('DBI:mysql:'.$sDatabaseName, $sDatabaseUser, $sDatabasePass) &#124;&#124; die &#34;Could not connect to database: $DBI::errstr&#34;;
$myquery   = &#34;UPDATE $sUserTable SET $sPasswordTableField=ENCRYPT('$sPassword') WHERE $sUsernameTableField='$sUsername';&#34;;
$statement = $connect-&#62;prepare($myquery);
$statement-&#62;execute();
$bResult = 1;
},last SWITCH;

$sOperation eq 'isuser' and do {
$bResult   = 0;
$connect   = DBI-&#62;connect('DBI:mysql:'.$sDatabaseName, $sDatabaseUser, $sDatabasePass) &#124;&#124; die &#34;Could not connect to database: $DBI::errstr&#34;;
$myquery   = &#34;SELECT count(*) AS iCount FROM $sUserTable WHERE $sUsernameTableField='$sUsername';&#34;;
$statement = $connect-&#62;prepare($myquery);
$statement-&#62;execute();
$row = $statement-&#62;fetchrow_hashref();
if($row-&#62;{'iCount'} &#62;= 1){
$bResult = 1;
}
},last SWITCH;
};

my $sOutput = pack &#34;nn&#34;,2,$bResult ? 1 : 0;
syswrite STDOUT,$sOutput;
}
closelog;
</pre>
<p><span lang="en-us"><br />
Or you download the script here: </span><span lang="en-us"><a class="downloadlink" href="http://www.mogilowski.net/wp-content/plugins/download-monitor/download.php?id=8" title="Version 1.0 heruntergeladen 305 mal" >auth_mysql.pl (1 KB)</a></span></p>
<p><span lang="en-us">Now make the script executeable:</span></p>
<pre>
chmod +x /etc/ejabberd/auth_mysql.pl
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mogilowski.net/lang/en-us/2009/02/04/authenticate-ejabberd-with-an-mysql-database/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Log Apache2 access log into a MySQL database on Debian Lenny</title>
		<link>http://www.mogilowski.net/lang/en-us/2008/11/26/log-apache2-access-log-into-a-mysql-database-on-debian-lenny</link>
		<comments>http://www.mogilowski.net/lang/en-us/2008/11/26/log-apache2-access-log-into-a-mysql-database-on-debian-lenny#comments</comments>
		<pubDate>Wed, 26 Nov 2008 08:29:27 +0000</pubDate>
		<dc:creator>sebastian</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[access log]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[mod-log-sql-mysql]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.mogilowski.net/?p=176&#038;lang=de-de</guid>
		<description><![CDATA[This article describes how you can log your apache access log entries into a MySQL database. You need a installed and configurated Apache2 webserver and MySQL server. Installation: On the webserver: aptitude install libapache2-mod-log-sql-mysql a2enmod unique_id On the database server: Create a new database &#8220;apachelogs&#8221; and a user for this database. Configurate a virtual host: [...]]]></description>
			<content:encoded><![CDATA[<p><span lang="en-us">This article describes how you can log your apache access log entries into a MySQL database.</span></p>
<p><span lang="en-us">You need a installed and configurated Apache2 webserver and MySQL server.</span></p>
<h3><span lang="en-us">Installation:</span></h3>
<p><strong><span lang="en-us">On the webserver:</span></strong></p>
<pre>
aptitude install libapache2-mod-log-sql-mysql
a2enmod unique_id
</pre>
<p><strong><span lang="en-us">On the database server:</span></strong></p>
<p><span lang="en-us">Cr</span><span lang="en-us">eate a new database &#8220;apachelogs&#8221; and a user for this database.</span></p>
<p><strong><span lang="en-us">Co</span><span lang="en-us">nfigurate a virtual host:</span></strong></p>
<p><em><span lang="en-us">Re</span><span lang="en-us">place &#8220;PASSWORD&#8221; and &#8220;DATABASE_SERVER&#8221; with your own data.</span></em></p>
<pre>
LogSQLLoginInfo mysql://apachelogs:PASSWORD@DATABASE_SERVER/apachelogs
LogSQLCreateTables on
LogSQLDBParam socketfile /var/run/mysqld/mysqld.sock
LogSQLTransferLogFormat IAbPcMfRhluTrmHtUapzqQsSV

&#60;virtualhost www.testsrv.local:80&#62;
ServerName www.testsrv.local
ServerAdmin servermaster@testsrv.local
DocumentRoot /var/www/vhost1/htdocs
ErrorLog /var/www/vhost1/logs/error.log
CustomLog /var/www/vhost1/logs/access.log common

LogSQLTransferLogTable vhost1_access_log

&#60;/virtualhost&#62;
</pre>
<pre>
/etc/init.d/apache2 reload
</pre>
<p><span lang="en-us"><em>mod-log-sql-mysql will create a table &#8220;vhost1_access_log&#8221; and log the Apache2 access there.</em></span></p>
<h3><span lang="en-us">Problems:</span></h3>
<p><span lang="en-us">Y</span><span lang="en-us">ou can get several errors in the apache error log when running the module:</span></p>
<p>1. &#8220;No such file or directory: attempted append of local preserve file &#8216;/etc/apache2/logs/mod_log_sql-preserve&#8217; but failed.&#8221;</p>
<p><span lang="en-us">You have to create the directory &#8220;/etc/apache2/logs&#8221; manual or create a symlink to &#8220;/var/log/apache2&#8243;.</span></p>
<p>2. &#8220;failed to create table: score_board&#8221;</p>
<p><span lang="en-us">There is a problem with scoreboard table creation, you have to create it:</span></p>
<pre>
CREATE TABLE IF NOT EXISTS `scoreboard` (
`id` int(14) NOT NULL auto_increment,
`vhost` varchar(50) NOT NULL default '',
`bytes_sent` int(14) NOT NULL default '0',
`count_hosts` int(12) NOT NULL default '0',
`count_visits` int(12) NOT NULL default '0',
`count_status_200` int(12) NOT NULL default '0',
`count_status_404` int(12) NOT NULL default '0',
`count_impressions` int(18) NOT NULL default '0',
`last_run` int(14) NOT NULL default '0',
`month` int(4) NOT NULL default '0',
`year` int(4) NOT NULL default '0',
`domain` varchar(50) NOT NULL default '',
`bytes_receive` int(14) NOT NULL default '0',
PRIMARY KEY  (`id`),
UNIQUE KEY `vhost` (`vhost`,`month`,`year`,`domain`)
) TYPE=MyISAM;
</pre>
<p><span lang="en-us">Thanks to Alexandre Bulté for the solution !</span></p>
<h3>Links:</h3>
<p><a href="http://blog.bulte.net/2008/04/apache-modlogsql-problem-with.html" target="_blank">http://blog.bulte.net/2008/04/apache-modlogsql-problem-with.html</a><br />
<a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" target="_blank">http://www.outoforder.cc/projects/apache/mod_log_sql/</a><br />
<a href="http://www.howtoforge.com/apache2-logging-to-a-mysql-database-with-mod_log_sql-on-debian-etch" target="_blank">http://www.howtoforge.com/apache2-logging-to-a-mysql-database-with-mod_log_sql-on-debian-etch</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mogilowski.net/lang/en-us/2008/11/26/log-apache2-access-log-into-a-mysql-database-on-debian-lenny/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 60/108 queries in 0.073 seconds using apc
Object Caching 827/842 objects using apc
Content Delivery Network via cdn.mogilowski.net

Served from: www.mogilowski.net @ 2012-02-07 05:48:22 -->
