9

I install mariadb in arch-linux. but I haven't got access to MySQL. I try this:

 mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I see very similar question, and test all of answers but I can't resolve it.

Zelda
  • 6,158
  • 1
  • 21
  • 27
Vahid Kharazi
  • 517
  • 4
  • 10
  • 15

5 Answers5

7

You should have been asked for the password during installation.

In case you do not remember your password, you can always reset your password.

Veger
  • 119
  • 5
michas
  • 21,190
  • 4
  • 63
  • 93
2

The wiki says you should be able to log in with an empty password for root like so:

$ mysql -u root -p

However, you may still get an error when you use an empty password:

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

You also need to be the system root user in order to log in via this account. You can use sudo to accomplish this:

$ sudo mysql -u root -p

This should let you log in as root.

ProdigySim
  • 121
  • 1
0

Mariadb/Mysql

Reset password using this link. https://bbs.archlinux.org/viewtopic.php?id=51981

sudo rm -r /var/lib/mysql
sudo pacman -Rn mysql
sudo pacman -S mysql
sudo /usr/bin/mysql_install_db
sudo /usr/bin/mysql_secure_installation

you can run all the commands, running last command again worked for me.

Rahul Bali
  • 101
  • 4
0

first you must to start the service (/etc/init.d/mysqld start). if the installation didn't ask you the password simply press Enter.

sudo mysql -u root -p

abidi12
  • 1
  • 1
-2

first you must to start the service (/etc/init.d/mysqld start). if the installation didn't ask you the password simply press Enter.