Archive for the ‘database’ Category

MySQL, ERROR 1366 and Windows cmd prompt

Tuesday, August 3rd, 2010

I have been trying to restore a database backup onto my laptop.

The source database used Character Set UTF8, so I created a local database with the same character set. The database contained several unusual characters such as â and é, so I was careful to choose the same character set.

I opened a command prompt and tried to load the backup at the command line:

D:\backup> mysql -u user -ppassword mydb < backup.sql

I got the error:

ERROR 1366 (HY000) at line 21364: Incorrect string value:
 '\xC1guas ...' for column 'address2' at row 1

I checked my.ini, and as far as I could see, everything was set to UTF8.

A quick internet search located this MySQL bug report: http://bugs.mysql.com/bug.php?id=30131

The work around to set the code page did not seem to work for me.

So I tried loading the backup using a GUI interface to MySQL instead (I use the free DBManager from DbTools). And the backup loaded fine! So definitely some odd behaviour from the Windows Command prompt.

save MySQL!

Monday, January 4th, 2010

http://www.helpmysql.org

Compiling mnogosearch with MySQL support & PHP extension on 64bit Centos5

Monday, August 17th, 2009

We just got a new dedicated server, running Centos 5.  I’ve just been moving some php websites which use the mnogosearch extension, and finally cracked it.

The main problem I was getting was:

/usr/bin/ld: cannot find -lmysqlclient

Here is a rough outline of what I had to do:

Install Mysql development

  1. yum install mysql-devel

Download & build mnogosearch

  1. wget http://www.mnogosearch.org/Download/mnogosearch-3.3.8.tar.gz
  2. edit “configure” script so that MYSQL_LIBDIR=/usr/lib64/mysql
  3. install.pl choosing appropriate options (I chose yes for build shared libraries)
  4. make
  5. make install

Build PHP extension

  1. cd mnogosearch-3.3.8/php
  2. follow instructions in  README file here
  3. service httpd restart

(I tried to get it working with PostgreSQL support too, but kept getting “/usr/bin/ld: cannot find -lpq”. The fix for setting the library path in the configure file didn’t seem to work in this case, but I didn’t try too hard.)