1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How can I create a MySQL database using ssh and sudo?

Discussion in 'Site & Server Administration' started by hvalle98, Feb 6, 2010.

  1. #1
    Hello everyone,

    I need to create a database on a CentOS server using ssh, but I don't own the root account, I'm just an user with sudo capabilities. Is there a command to do this? Or I'll have to ask the server owner to create the db for me?

    Thanks in advance!
     
    hvalle98, Feb 6, 2010 IP
  2. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Login to MySQL root account (mysql -uroot will likely work if you didn't set a password) and type the following:

    
    CREATE DATABASE `mydatabase`;
    GRANT ALL PRIVILEGES ON `mydatabase`.* TO `myuser`@`localhost` IDENTIFIED BY 'somepassword';
    FLUSH PRIVILEGES;
    
    Code (markup):
    Obviously adjust accordingly.. I would also recommend not using all privileges unless needed.. explicitly set which grants you want (SELECT, UPDATE, etc)
     
    CodyRo, Feb 7, 2010 IP