SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    Not Bad, eh? Justin Sampson's Avatar
    Join Date
    Aug 2000
    Location
    N.S., Canada
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Is there any way I can rename a database just like you rename a table? I need to be able to rename it without loosing my tables and data.

    Thanks,
    Justin Sampson

  2. #2
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    There is no explicit command to migrate one database to another.

    You could dump your tables and data to text files. Create your new database and import the tables and data. Once everything is working good then you can delete the original table.
    Wayne Luke
    ------------


  3. #3
    SitePoint Evangelist
    Join Date
    Jul 2000
    Location
    Warwickshire, England
    Posts
    557
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In the win32 version, you can rename the database simply by renaming the respective folder in <mysqldir>\data
    I have tested this and it seems to work fine. You could try this in the linux version aswell (which I presume you have), but stop mysql before you do this.
    You also might want to take a backup

  4. #4
    Not Bad, eh? Justin Sampson's Avatar
    Join Date
    Aug 2000
    Location
    N.S., Canada
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys!
    W. Luke's methed worked perfect

  5. #5
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    as for mysql, i think adding appropriate permission settings and just renaming the database directory works fine too.. i've not done THAT exactly, but i've done similar stuff, so dont quote me on that

    --------------------
    SitePoint Community Advisor
    myPHPhost: hey, PHP all the way babyee

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Renaming the directory does indeed work just fine, but you'll need to update your permissions if you have any assigned to that particular database.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


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
  •