Showing entries 1 to 10 of 18
8 Older Entries »
Displaying posts with tag: How Tos (reset)
Resolving Error 1918, System Error Code 126, When Installing MySQL ODBC Driver

If you are installing MySQL ODBC Driver and encounter the following error:

Error 1918. Error installing ODBC driver MySQL ODBC 5.1 Driver, 
ODBC error 13: The setup routines for the MySQL ODBC 5.1 Driver 
could not be loaded due to system error code 126: 
The specified module could not be found. 
...\myodbc5S.dll).. Verify...

Then you will need to install the Microsoft Visual C++ 2010 Redistributable Package (select the appropriate one for your OS architecture below):

64-bit version:

read more

Improve your Stored Procedure Error Handling with GET DIAGNOSTICS

In a previous post, I discussed debugging stored procedures with RESIGNAL, which is of great value when troubleshooting errors raised by your stored procedures, functions, triggers, and events as of MySQL/MariaDB 5.5.

However, as of MySQL 5.6 and MariaDB 10.0, there is GET DIAGNOSTICS, which can be used to get the exact error details as well.

RESIGNAL just outputs the error, as it comes from the server, for instance:

ERROR 1146 (42S02): Table 'db1.t1' doesn't exist

read more

Quickly Debugging Stored Procedures, Functions, Triggers, and Events with RESIGNAL

I was recently debugging a stored procedure and could not easily identify the underlying reason for why it was failing.

It had a standard exit handler catch-all for SQLEXCEPTION, which was:

DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
SELECT ...;
END;

When there was an error, it didn't really output anything useful.

As of MySQL 5.5, there is RESIGNAL:

"RESIGNAL passes on the error condition information that is available during execution of a condition handler within a compound statement inside a stored procedure or function, trigger, or event."

read more

Google Docs sharing and its cloudy usability

Background: SkySQL is a distributed company. Nearly all of us work from home. To be productive, we need to emulate the best aspects of collaborating as if we were working next to one another. Given that nearly all of us had worked under similar distributed conditions at MySQL AB, we knew what we were getting into when we were founded. Obviously, we wanted to learn from our past experiences when making our choices for tools and processes.

read more

How To – Configure MySQL to Use UTF-8

Background Knowledge

Using the character set UTF-8 allows for the use of any language, can represent every character in the Unicode character set and is backward compatibility with ASCII. Not to mention is can handle any platform and be sent through many different systems without corruption. With such advantages this is why so many are making the switch.

The following instructions were done on Debian Squeeze v6.04 AMD64 operating system using MySQL v14.14 Distrib 5.1.61.

Solution – Server Configuration

At present MySQL is configured by default to use “latin1″ character set. Here’s how to change MySQL configuration to use UTF-8 character set and collation.

  1. Check MySQL’s current configuration, run the following two SQL statements.

    1
    2
    
    SHOW VARIABLES LIKE '%collation%'; …
[Read more]
How To – Fix MySQL Option Without Preceding Group

Background Knowledge

You try starting, stopping or connecting to MySQL and receive the following error, “Error: Found option without preceding group in config file: /etc/mysql/conf.d/char_collation_set.cnf at line: 1″. The error message my vary but comes to the same issue. MySQL may not start or might experience connectivity issues.

This issue was experienced on Debian Squeeze v6.04 AMD64 system with MySQL v14.14 Distrib 5.1.61.

Solution

This issue is caused by a improperly formatted MySQL configuration file(s) and refers to one missing the group heading (e.g. [mysqld], [mysqld_safe], etc.).

Source: MySQL 5.1 Reference Manual :: 4.2.3.3. Using Option Files
Source: …

[Read more]
How To – Resolve MySQL Error Incorrect Key File for Table

Background Knowledge

I using PHP v5.3.3-7 PDO running a MySQL v14.14 Distrib 5.1.49 on Debian v6.0.4 64-bit and executing a SQL load data infile statement.

I received “PHP Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 126 Incorrect key file for table ‘/tmp/#sql_66f_0.MYI’; try to repair it”. My database table in this instance is using the storage engine of InnoDB and therefore one can not use the “repair table”.

From my experience I’ve found that this error can mean one of two issues however I have not found information from MySQL confirming this.

Solution – Repair Table

The error message may mean the database table is corrupted and requires a repair.

  1. Run repair table on the …
[Read more]
MySQL 5.5 Defaults may pose Performance Issues

We have seen a few instances where upgrades of MySQL 5.1 to 5.5 have resulted in poor performance when using default values. After investigation it would appear that the main culprit appears to be the innodb_thread_concurrency setting.

In MySQL 5.1 the default was 8, while in MySQL 5.5, the default was changed to 0 (unlimited).

So what does innodb_thread_concurrency do and why would it cause performance issues?

The value given to innodb_thread_concurrency sets the number of simultaneous threads the InnoDB engine will create.  If there are more jobs waiting to be processed than there are available thread slots, these jobs will be made to wait until a thread slot becomes free.  So on the face of it, making this unlimited sounds like a good idea - so you won't have any jobs waiting on thread slots.

In an ideal world, unlimited is good.  In the real world, unlimited doesn't exist.  CPUs only have …

[Read more]
Client requested master to start replication from impossible position

If you run a replicated MySQL setup and have a master failure, you may see the following error in your error log.

[ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236)

At this point your slave will not be replicating and you will need to recover from the situation. But why did it occur in the first place and what does it mean to your data integrity?

Why it occurs

This error will occur if the master stops unexpectedly. This could be as a result of a hardware failure (like a disk error) or a power loss.  Any time this happens there is a chain of events that result in the problem.

First of all MySQL holds a lot of information in memory.  Even with InnoDB there may be a pending transaction that has not yet written to the log, but even more importantly the server may not be able to write the Stop event message to the …

[Read more]
How To – Convert MSSQL Timestamp/Datetime to Unix Timestamp

Background Knowledge

I will explain how to convert a DATETIME (data type) value in Microsoft SQL Server to Unix timestamp and how to convert Unix timestamp to DATETIME. A Unix timestamp is a integer value of seconds since January 1, 1970 at midnight. For further explanation of Unix timestamps refer to Wikiepedia, UnixTimestamp.com or http://unixtimesta.mp/.

Note: This solution only work on dates prior to 2038-01-19 at 3:14:08 AM, where the delta in seconds exceeds the limit of the INT data type (integer is used as the result of DATEDIFF). See source for further details as I have not verified a solution to this problem.

Solutions

Convert Datetime Value to Unix Timestamp (today)

[Read more]
Showing entries 1 to 10 of 18
8 Older Entries »