SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mysql error 1005 (can't create table)

    I'm currently trying to get RoR to work on my machine (I'm nearly, nearly there) but now I'm having problems with mysql 4.x, it won't let me alter tables or create new ones on mass...

    Example;

    SQL query:

    CREATE TABLE `recipes` (
    `id` TINYINT NOT NULL AUTO_INCREMENT ,
    `title` VARCHAR( 32 ) NOT NULL ,
    `instructions` VARCHAR( 32 ) NOT NULL ,
    PRIMARY KEY ( `id` )
    ) TYPE = innodb

    MySQL said: Documentation
    #1005 - Can't create table '.\cookbook\recipes.frm' (errno: 121)
    A similar error occures when I want to alter the table, rename it or change one of the fields.

    I've tried restarting my machine, restarting apache/mysql, reinstalling mysql ... I haven't tried restarting my machine...

    Googling the error says that its a problem with foreign keys, but how is this relating to creating/altering a table from scratch?

    I recently downloaded a mysql.so and a msvcr70.dll file and put this into some ruby folders to make RoR work with mysql -- does these files conflict with mysql?

    How do i fix the 1005 error?

    Thanks.

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does the mysql user that you are logging into mysql as, have proper permissions to create and alter tables? you will have to check the USER table inside the MYSQL database to see if the proper permissions exist.

  3. #3
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mmm, I'll check that out.

  4. #4
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I checked out all the privileges, nothing seems to be a miss;

    global privileges (all checked)
    ========================
    SELECT CREATE GRANT
    INSERT ALTER SUPER
    UPDATE INDEX PROCESS
    DELETE DROP RELOAD
    FILE CREATE TEMPORARY TABLES SHUTDOWN
    SHOW DATABASES
    LOCK TABLES
    REFERENCES
    EXECUTE
    REPLICATION CLIENT
    REPLICATION SLAVE

    =======


    Database specific privileges;

    Database: cookbook

    Privileges: ALL PRIVILEGES
    Grant Yes

    Table-specific privileges: No
    So, if global privileges are okay, and database specific are all granted, why won't it let me create new tables, alter them?

    [edit]

    Just tried dropping the database, now mysql has lost connection, tried dropping it in dos prompt but it can't reinstate connection... must be ror causing problems... will restart machine.

  5. #5
    SitePoint Guru worchyld's Avatar
    Join Date
    Jul 2003
    Location
    Newcastle upon Tyne
    Posts
    909
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems to be a problem with the InnoDB, when I use MyISAM - there is no problem at all... very strange. I've used "show engine innodb status\g" at mysql prompt but it shows no major errors, or bad foreign keys... I may end up restarting my machine from stratch if necessary.

    Oh well. Back to the salt mines!

  6. #6
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    check you mysql configuration file. for a while there, the default file was specifying a separate directory for the innodb files vs. the myisam files. sounds like inno can't create the files it needs because of a bad directory being specified.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •