rename table name

Discussion in 'Databases' started by xAlexKimx, Jul 5, 2007.

  1. #1
    Hi all,
    I need help with renaming table. For example "adminaccess" rename it to "new_adminaccess"
    I was using phpMyAdmin to do it, but I didn't know how to.
    Can anyone help?
    Thanks in advance ;
    Alex,
     
    xAlexKimx, Jul 5, 2007 IP
  2. SUSH

    SUSH Peon

    Messages:
    28
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In phpmyadmin:
    > Select the database you have the table in.
    > Next to the tablename in the "bigger" right frame, second icon is "structure". Click it.
    > Select "operations" in top tabs.

    Here you'll see an option to rename the table.
    Hope that helps...
    regards :)
     
    SUSH, Jul 5, 2007 IP
  3. xAlexKimx

    xAlexKimx Well-Known Member

    Messages:
    547
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    158
    #3
    thank you sush, i will do it now and see how it works
    thanks alot sush
     
    xAlexKimx, Jul 5, 2007 IP
  4. xAlexKimx

    xAlexKimx Well-Known Member

    Messages:
    547
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    158
    #4
    #1142 - ALTER command denied to user 'alexkim'@'localhost' for table 'access'

    i got that error message
     
    xAlexKimx, Jul 5, 2007 IP
  5. SUSH

    SUSH Peon

    Messages:
    28
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That means that the "user" connecting to the database does not have permissions to do this.
    The query is:
    RENAME TABLE `db_name`.`table_name` TO `db_name`.`new_table_name`

    Your user does not have "rename" permissions.

    A second way is to do an "export" of this table, download the file it creates.
    Open this file in notepad
    Find your table name, and replace it with your new table name
    You'll find the table name near the following:

    CREATE TABLE `table_name`
    INSERT INTO `table_name`

    Change it here, and do an import.

    If your table is big, then doing this will be a pain...
    Do not "drop" the old table until your new table is properly created.
    regards :)
     
    SUSH, Jul 6, 2007 IP