Tag: database

  • How to rename a mysql database or table

    Here is a dirty script to rename a mysql database or table from command line. Dont for get to stop mysql service!

    cd /var/lib/mysql/
    /etc/init.d/mysql stop
    # rename database...
    mv olddbname newdbname
    # ...or table
    cd database/
    mv oldname.frm newname.frm
    mv oldname.MYD newname.MYD
    mv oldname.MYI newname.MYI
    /etc/init.d/mysql start