I am an electrical engineer who mainly plays around with power systems instead of programming. Recently, I have been following a manual to install a software suite on Ubuntu. I have no knowledge of mySQL
at all, actually. I have done the following installations on my Ubuntu.
sudo apt-get update
sudo apt-get install mysql-server-5.5
sudo apt-get install mysql-client-5.5
sudo apt-get install mysql-common
sudo apt-get install glade
sudo apt-get install ntp
Then I do
me@ubuntu:~/Desktop/iPDC-v1.3.1/DBServer-1.1$ mysql -uroot -proot <"Db.sql"
I ended up with the following error message.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
How may I fix it and continue?
Note: For MySQL 5.7+ please see answer from @Lahiru to this question. That contains more current information.
For MySQL < 5.7:
The default root password is blank (i.e. empty string) not root
. So you can just login as:
mysql -u root
You should obviously change your root password after installation
mysqladmin -u root password [newpassword]
In most cases you should also set up individual user accounts before working extensively with the DB as well.