Posts Tagged ‘root’

Use different color for root terminal on Linux

December 4, 2015 Leave a comment

Looking for a way to distinguish the different terminals i usually have opened, I found this post:

It just changes the prompt color, red if you’re root, adding this line at the end of /root/.bashrc:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

and green for normal users, adding this to your ~/.bashrc

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

and restarting the terminals.

Now it’s easier to know if you’re root or not!

Please, feel free to leave your comments

Categories: linux, ubuntu Tags: ,

MySQL: Error 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO) [REVISITED]

November 7, 2015 Leave a comment

Have you ever read my 2011 post about this error? Check this before:

After that, if you’re still getting the same error, simply try this:

$ mysql -u root -p

You’ll be prompted for root password. Type it and you’re connected to the database.

Please, share your comments below.

Categories: MySQL Tags: , , ,

MySQL: Error 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

November 21, 2011 36 comments

I’ve upgraded MySQL server version to 5.1.54-1ubuntu4 and when I try to connect to the database I’m getting this error:

$ mysql -u root

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

Maybe updating the package the updater overwrote the root password.

To restore it:

  • Stop mysqld deamons.
$ sudo service mysql stop
  • Go  to  mysql/bin directory
$ cd /usr/bin
  • Start a mysql deamon with this option:
$ sudo mysqld_safe --skip-grant-tables
  • Open another terminal and open a mysql session to execute this:
$ mysql
mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD('YOUR_NEW_PASSWORD_HERE') WHERE user = 'root';
mysql> exit;
  • Now kill the mysqld_safe process and restart mysqld normally:
$ sudo service mysql start
Categories: MySQL, ubuntu Tags: , , , ,