Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

making mysql db in ssh

Discussion in 'General Discussion' started by silvernetuk, Jan 8, 2003.

  1. silvernetuk

    silvernetuk Well-Known Member

    Joined:
    Sep 2, 2002
    Messages:
    311
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    United Kingdom
    Hi,

    We are currently have problems with out CPanel License Expired, due to an Base IP Change however this has not been updated yet :(

    Any how, how do I make a database from ssh at the mysql for a client ? so when cpanel comes back online there be no problems with the database.

    So how do I make it in SSH ?

    Regards,
    Garry
     
  2. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,574
    Likes Received:
    3
    Trophy Points:
    343
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    From an SSH prompt do the following;

    #mysql -pPASSWORD FOR MYSQL
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 387 to server version: 3.23.54

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql& CREATE DATABASE user_databasename;

    You should get
    Query OK, 1 row affected (0.00 sec)

    mysql& SHOW DATABASES;

    This will show you the databases installed.

    Hope that helps.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. silvernetuk

    silvernetuk Well-Known Member

    Joined:
    Sep 2, 2002
    Messages:
    311
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    United Kingdom
    Hi,

    What about username and password for it and how do you add it ?

    Regards,
    Garry
     
  4. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,574
    Likes Received:
    3
    Trophy Points:
    343
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    If the user does not exist do the following from the mysql prompt;

    mysql& use mysql;
    mysql& INSERT INTO user (Host,User,Password)
    -& VALUES('localhost','username',PASSWORD('thepassword'));
    mysql& FLUSH PRIVILEGES;

    To add them to the database you created;

    mysql& GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
    -& ON username.database
    -& TO username@localhost
    -& IDENTIFIED BY 'thepassword';
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. silvernetuk

    silvernetuk Well-Known Member

    Joined:
    Sep 2, 2002
    Messages:
    311
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    United Kingdom
    HI,

    I am lost now.

    The clients has an account setup on the server already and has one database, but want another one and as CPanel is offline at the min. I need to make the account in SSH.

    I get the first bit
    mysql& CREATE DATABASE user_databasename;

    But when using a database with a forum or something it need a username and password how do I make these ?

    Regards,
    Garry
     
  6. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,574
    Likes Received:
    3
    Trophy Points:
    343
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    That's this part

    To add them to the database you created;

    mysql& GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
    -& ON username.database
    -& TO username@localhost
    -& IDENTIFIED BY 'thepassword';

    This will allow the user to connect with their id. You will have to either create a password for him or ask him which one to use.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,574
    Likes Received:
    3
    Trophy Points:
    343
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    You could also install another copy phpmyadmin and access everything from there.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. silvernetuk

    silvernetuk Well-Known Member

    Joined:
    Sep 2, 2002
    Messages:
    311
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    United Kingdom
    Hi,

    That great, I have worked it out now :)

    I am hoping CPanel going to be working soon as the License is still on the old IP :(

    Regards,
    Garry
     
  9. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,574
    Likes Received:
    3
    Trophy Points:
    343
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Glad to be of help. :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice