Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Sunday, November 28, 2010

Some random mysql pitfalls.

Constraints
Only PK, FK, Nullability, Unique are enforced in InnoDB. Check (expression) is not. So don't expect the following check constraint to help you catch any insertion/update with foo.value <= 20.



FK
both sides of your FK should have exactly the same signature. Otherwise you get errno 150, which indicates a syntax error in FK definition.

Monday, September 27, 2010

Uninstalling MySQL on Mac OS X

Source: http://steveno.wordpress.com/2009/03/26/uninstall-mysql-on-mac-os-x/

  • sudo rm /usr/local/mysql
  • sudo rm -rf /usr/local/mysql*
  • sudo rm -rf /Library/StartupItems/MySQLCOM
  • sudo rm -rf /Library/PreferencePanes/My*
  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  • sudo rm -rf /Library/Receipts/mysql*
  • sudo rm -rf /Library/Receipts/MySQL*

Saturday, March 8, 2008

Install mysql++ for C++ connection to mysql database

1. Install mysql

2. Install mysqlpp-3.0 from source
http://tangentsoft.net/mysql++/releases/mysql++-3.0.0.tar.gz.
Don't use apt-get to install libmysqlpp-dev if you are using old version of ubuntu. It would give you outdated version of mysql++.
Generally it would be install in /usr/local/include and the libs would appear in /usr/lib/ or /usr/local/lib.

3. include mysql++.h in your program.

4. in your make file, put the following flags when you compile and build:
//include the header files
-I/usr/local/include/mysql++ -I/usr/include/mysql
//load the libraries. otherwise you are gonna get undefined reference error during linking stage.
-L/usr/local/lib -lmysqlpp (-lmysqlclient)
The path might differ from different linux distributions. Look for the lib named libmysqlpp.so* and libmysqlclient.so*.

5. remember to put the library path in /etc/ld.so.conf, and sudo ldconfig