Difference between revisions of "Database Tips"

From Opentaps Wiki
Jump to navigationJump to search
(UTF-8 Support)
Line 1: Line 1:
 
__TOC__
 
__TOC__
  
==Database Tips and Tricks==
+
==MySQL Tips==
  
===MySQL===
+
===Table Name Case Sensitivity===
 
 
====Table Name Case Sensitivity====
 
  
 
If you use Linux or Unix for your MySQL server, the table names may be case sensitive, so PRODUCT and product are not the same table.  You can turn this off by configuring mysqld on startup to ignore table names with the lower-case-table-names flag, such as this example from /etc/init.d/mysql:
 
If you use Linux or Unix for your MySQL server, the table names may be case sensitive, so PRODUCT and product are not the same table.  You can turn this off by configuring mysqld on startup to ignore table names with the lower-case-table-names flag, such as this example from /etc/init.d/mysql:
Line 12: Line 10:
 
See [http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html MySQL manual on identifier case sentivity]
 
See [http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html MySQL manual on identifier case sentivity]
  
====UTF-8 Support====
+
===UTF-8 Support===
  
 
By default, MySQL supports the Latin1 character set, which is intended for European languages such as English.  If you wish to use MySQL for other language types, you may need to set up a database or UTF-8 character set encoding.  To do this, you would need to create your database using UTF-8 first:
 
By default, MySQL supports the Latin1 character set, which is intended for European languages such as English.  If you wish to use MySQL for other language types, you may need to set up a database or UTF-8 character set encoding.  To do this, you would need to create your database using UTF-8 first:

Revision as of 00:08, 14 March 2008

MySQL Tips

Table Name Case Sensitivity

If you use Linux or Unix for your MySQL server, the table names may be case sensitive, so PRODUCT and product are not the same table. You can turn this off by configuring mysqld on startup to ignore table names with the lower-case-table-names flag, such as this example from /etc/init.d/mysql:

 $bindir/mysqld_safe --datadir=$datadir --lower-case-table-names=1 --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
     

See MySQL manual on identifier case sentivity

UTF-8 Support

By default, MySQL supports the Latin1 character set, which is intended for European languages such as English. If you wish to use MySQL for other language types, you may need to set up a database or UTF-8 character set encoding. To do this, you would need to create your database using UTF-8 first:

   mysql> create database opentaps default character set utf8 collate utf8_general_ci;

Then you would need to set your framework/entity/config/entityengine.xml file for the MySQL database to use the UTF-8 character set:

            character-set="utf8"
            collate="utf8_general_ci" 

Note that it is not clear that my SQL supports case sensitive UTF-8 coalition at this point, although you may be able to [use UTF-8 binary collation].