1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mysql command line query command

Discussion in 'Server Configuration and Hosting' started by faeronsayn, Aug 23, 2012.

  1. faeronsayn

    faeronsayn Well-Known Member

    So I want to execute queries through mysql command line on putty.

    I can't seem to find a command to do that exactly. If anyone knows, please post it below.
     
  2. Bob

    Bob Well-Known Member

  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Login to MySQL and select your database:

    mysql -uUSERNAME -pPASSWORD DBNAME

    Type queries into the mysql prompt. Note that you must end queries with a semicolon when using the mysql prompt. The enter key will merely insert a line break into the query which isn't functional. It won't execute the query until you type a semicolon and then hit enter.
     
    faeronsayn likes this.
  4. Floren

    Floren Well-Known Member

    I would skip the password, is very easy for an attacker to intercept your text data while you send it from a terminal.
     
    faeronsayn likes this.
  5. hellreturn

    hellreturn Active Member

    Then how would you send password? Example to explain on how to do it correctly will help.

    Thank you
     
  6. p4guru

    p4guru Well-Known Member

    Code:
    mysql -uUSERNAME -p DBNAME
    Like that, it will prompt for password
     
    hellreturn likes this.
  7. Floren

    Floren Well-Known Member

    The way I do it is:
    mysql -u root -p

    From there, I select whatever options I'm interested to deal with.
     

Share This Page