The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to copy all mysql users manually?

Discussion in 'Data Protection' started by rastoma, Apr 15, 2010.

  1. rastoma

    rastoma Well-Known Member

    Joined:
    Aug 27, 2001
    Messages:
    158
    Likes Received:
    0
    Trophy Points:
    16
    If a drive is too full and I can't run backups, I want to copy the entire /var/lib/mysql directory but that doesn't copy db users and permissions.

    Where is the db user data located?
     
  2. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    db users and privileges are in the database "mysql".
     
  3. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Make a dump of the MySQL database

    As yapluka mentioned, these data are in the mysql database. The best way to preserve these data is to make a dump of the mysql database, which will create a file that contains all of the commands needed to create the database again. A very basic use of the mysqldump command would be the following:

    Code:
    # mysqldump mysql > /root/mysql.sql
    This will create a dump file in /root, mysql.sql, that contains all of the SQL statements needed to create the mysql database again. To import the database in the future, simply redirect the dump file into MySQL:

    Code:
    # mysql mysql < /root/mysql.sql
    If you need to move the MySQL data directory due to lack of disk space, there are several threads in our forums that describe how to do this. A couple of good suggestions are the following:

    http://forums.cpanel.net/f5/move-mysql-databases-6655.html
    cPanel Forums - View Single Post - Move MySQL Databases
    http://forums.cpanel.net/f5/how-move-mysql-data-folder-110481.html
     
Loading...

Share This Page