Debian : Apache : PHP : Database Error: Unable to connect to the database:The MySQL adapter “mysql” is not available.

May 28, 2010

Got this today when I browsed to my Joomla site, which I had just imported from elsewhere.

Database Error: Unable to connect to the database:The MySQL adapter "mysql" is not available.

Setting the correct database password in the joomla configuration file fixed the issue.


Clearing the MySql Logs

August 19, 2009

mysql> show master logs;

+------------------+------------+
| Log_name         | File_size  |
+------------------+------------+
| mysql-bin.000023 | 1074039776 |
| mysql-bin.000024 | 1023334365 |
| mysql-bin.000025 | 1073742100 |
| mysql-bin.000026 | 4254255    |
| mysql-bin.000027 | 117        |
| mysql-bin.000028 | 98         |
+------------------+------------+
6 rows in set (0.00 sec)

mysql> purge master logs to ‘mysql-bin.000028′;
Query OK, 0 rows affected (10.35 sec)

mysql> show master logs;
+——————+———–+
| Log_name         | File_size |
+——————+———–+
| mysql-bin.000028 | 98        |
+——————+———–+
1 row in set (0.00 sec)

 

mysql>


On demand “Tailing” of a database log table: select the last x records

August 19, 2009

Recently I had to monitor some data being output to a log table while an application was running.

The log table was quite large, and being written to constantly and also by portions of that system I wasn’t interested in.

So I only wanted to see the 10 or 20 most recent rows / records written.

There are quite a few ways to do this, but this is what I threw together. It assumes the ordering is based on an incrementing unique record id.

select count(*) into @rowcount from prodlog; select id, source_id, created_on, message from prodlog where id > (@rowcount-20) order by id;

I put the latest count of records in the table into a temporary variable. I then use that figure, minus the number of rows I want to see, to offset into the data.

Note that if the count of rows and row ids don’t match (e.g. because you used truncate) the above method will fail.

In this case you may use:

select id into @last_id from prodlog order by id desc limit 1; select id, source_id, created_on, message from prodlog where id > (@last_id-20) order by id;

This is still potential issues with this, for instance you may get less than you expected if there are gaps in the id sequence.

But it sufficed for my needs at the time :)


Using MySql with Jahia on Debian GNU/Linux

October 6, 2008

After installing Jahia today, I wanted to use the MySql database instead of the default HyperSonic. I am currently using MySql for other purposes and want to have a look at accessing the Jahia database to re-use content.

Initially when I created the ‘jahia’ database in mysql and granted permissions to the Jahia user, Jahia reported:

"This database doesn't seem to support extended charsets."

Dropping the database and recreating it with a unicode dataset sorts this little niggle out.

mysql> create database jahia character set = utf8;


Follow

Get every new post delivered to your Inbox.