[Novalug] further questions on learning MySQL on ubuntu

William Morse wmorse@americancouncils.org
Thu Dec 16 17:36:39 EST 2010


Regarding the default character set,

The mysql manual implies that the default is set either through
compiling or through a command-line switch at startup. 
http://dev.mysql.com/doc/refman/5.0/en/charset-server.html


Another page suggests that you can use a configuration file to specify
the server character set.
http://dev.mysql.com/doc/refman/5.1/en/mysqld-option-tables.html 

And this page tells you where you might find configuration files:
http://dev.mysql.com/doc/refman/5.1/en/option-files.html

In practise, I have had not had great success using character sets
effectively... :-(



--
William Morse
Database Management
American Councils for International Education: ACTR/ACCELS
tel. 202-833-7522

-----Original Message-----
From: novalug-bounces@calypso.tux.org
[mailto:novalug-bounces@calypso.tux.org] On Behalf Of Bonnie Dalzell
Sent: Thursday, December 16, 2010 4:31 PM
To: NOVALUG
Subject: [Novalug] further questions on learning MySQL on ubuntu


Supposedly MySQL supports foreign keys if you use the INNODB database.

However my attempts to do a tutorial foreign key example have not been
successful.

Here is the result from the command line. The tutorial has me set up two
tables, zoo and species. The foreign key will be in zoo.

describe species;
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| id    | int(11)     | NO   | PRI | NULL    | auto_increment |
| name  | varchar(50) | NO   |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+

mysql> describe zoo
     -> ;
+------------+-------------+------+-----+---------+----------------+
| Field      | Type        | Null | Key | Default | Extra          |
+------------+-------------+------+-----+---------+----------------+
| id         | int(4)      | NO   | PRI | NULL    | auto_increment |
| name       | varchar(50) | NO   |     | NULL    |                |
| FK_species | tinyint(4)  | NO   | UNI | NULL    |                |
+------------+-------------+------+-----+---------+----------------+

when I try to add a foreign key - the syntax being from a tutorial
- I get an error:

mysql> alter table zoo add foreign key (FK_species) References species
(id);
ERROR 1005 (HY000): Can't create table 'test.#sql-592_237' (errno: 150)

anyone have any insight into this?

both zoo and the other table species are set as INNODB.


also if anyone can tell me how to configure my MySQL installation so the
default collation (character set) is either latin1_general_ci or
utf8_general_ci rather than latin1_swedish_ci I would appreciate it. Why
is latin1_swedish_ci the default when MySQL is installed? Was MySQL
invented by a Swede?


thanks.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        Bonnie Dalzell, MA mail:5100 Hydes Rd PO Box 60,
Hydes,MD,USA 21082-0060|EMAIL:bdalzell@qis.net Freelance anatomist,
vertebrate paleontologist, writer, illustrator, dog breeder, computer
nerd & iconoclast... Borzoi info at www.borzois.com.
HOME www.batw.net    ART bdalzellart.batw.net  BUSINESS
www.boardingatwedge.com

_______________________________________________
Novalug mailing list
Novalug@calypso.tux.org
http://calypso.tux.org/mailman/listinfo/novalug



More information about the Novalug mailing list