NickName:Raj Singhania Ask DateTime:2012-06-25T19:19:15 how to run mysql in ubuntu through terminal trying to run mysql in ubuntu typing mysql in terminal and getting error ERROR 1045(28000): Access denied for user 'root'@'localhost' (using password: NO) Can anybody please sort out this problem... Copyright Notice:Content Author:「Raj Singhania」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.Link to original article:https://stackoverflow.com/questions/11188351/how-to-run-mysql-in-ubuntu-through-terminal Answers lorenzo-s 2012-06-25T11:21:43 You have to give a valid username. For example, to run query with user root you have to type the following command and then enter password when prompted:\n\nmysql -u root -p\n\n\nOnce you are connected, prompt will be something like:\n\nmysql>\n\n\nHere you can write your query, after database selection, for example:\n\nmysql> USE your_database;\nmysql> SELECT * FROM your_table;\n", matcheek 2012-06-25T11:23:45 If you want to run your scripts, then\n\nmysql -u root -p < yourscript.sql\n", John Kane 2012-06-25T11:27:55 You need to log in with the correct username and password. Does the user root have permission to access the database? or did you create a specific user to do this? \n\nThe other issue might be that you are not using a password when trying to log in.", Prakhar Agrawal 2015-11-30T14:23:17 You seem to just have begun using mysql.\n\nSimple answer: for now use\n\n\n mysql -u root -p password\n\n\nPassword is usually root by default. You may use other usernames if you have created other user using create user in mysql. For details use \"help, help manage accounts, help create users\" etc. If you dont want your password to be shown in open just press return key after \"-p\" and you will be prompted for password next.\nHope this resolves the issue.",