MySQL Permissions?

Discussion in 'Site & Server Administration' started by hilljd00, Jan 5, 2010.

  1. #1
    Hey,

    I have a dedicated server [running Direct Admin] and before I transferred my websites across I backed them all up to my PC with the MySQL databases.

    When I try to import them through phpmyadmin it says

    I'm logged in as admin.

    I see its to do with permissions, but I can't find out how to fix this, any ideas?

    Thank you
    J
     
    hilljd00, Jan 5, 2010 IP
  2. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #2
    there are at least 2 ways to solve your permission problem:

    1.
    the easy way
    if you also backed up your previous database called "mysql"
    that database called mysql contains all privileges for all users and databases
    if you have a mysql backup also,
    then import that first as root into your new mysql db to re-establish all previous permissions/users/passwords

    2.
    the hard ( default way )
    if you moved from hosted site to dedicated own server, then you have NO "mysql" backup only your various dbases
    then you have to re-enter / re-configure all permissions for each dbase

    just weeks ago i have done a combination of BOTH above on my newest 3rd server - but I am unfamiliar with all the details for your situation. use the mysql manual or web site to find the precise syntax ( i do all mysql admin using command line W/O phpmyadmin

    login to mysql as user root
    then a syntax looks something similar to below - READ mysql manual for details:


    GRANT ALL PRIVILEGES ON `yourdatabasename1` . * TO 'username1'@'localhost' IDENTIFIED BY 'password1' WITH GRANT OPTION ;
    flush privileges;

    replace above

    - yourdatabasename1 with name of database
    - username1 username for THAT db
    - password1 password for that user accessing the db

    login to mysql as user root
    then a syntax looks something similar to below - READ mysql manual for details:
    http://dev.mysql.com/doc/


    GRANT ALL PRIVILEGES ON `yourdatabasename1` . * TO 'username1'@'localhost' IDENTIFIED BY 'password1' WITH GRANT OPTION ;
    flush privileges;

    replace above

    - yourdatabasename1 with name of database
    - username1 username for THAT db
    - password1 password for that user accessing the db


    make sure you have your proper mysql root password - often in a NEW linux install mysql runs WITHOUT password and needs first to be secured!!!

    in a fresh linux server install, usually mysql is secured using the shell command

    mysql_secure_installation
     
    hans, Jan 7, 2010 IP
  3. tamer1009

    tamer1009 Peon

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    check your user permissions in directadmin.
     
    tamer1009, Jan 7, 2010 IP