Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I am seeking to run MySQL in ubuntu typing mysql in the terminal and I am getting the below error.

ERROR 1045(28000): Access denied for user 'root'@'localhost' (using password: NO)

Can anyone help me sort out this problem?

1 Answer

0 votes
by (12.7k points)

You need to give a valid username. For example, to run a query with user root you need to type the following command and then enter the password when prompted:

mysql -u root -p

When you get connected, the prompt will be looking like:

mysql>

Then here you can write your query, after the database selection, for example:

mysql> USE your_database;
mysql> SELECT * FROM your_table;

Become a SQL expert with this complete SQL Training Course!

Related questions

0 votes
1 answer
asked Dec 5, 2020 in SQL by Appu (6.1k points)
+5 votes
2 answers
0 votes
1 answer
asked Feb 15, 2021 in SQL by adhiraj (4k points)
0 votes
1 answer

Browse Categories

...