Skip to content

Rage Against the Shell

Linux tips and other things…

  • Home
  • Contact
  • Privacy Policy

Change mysql root password

Posted on August 30, 2015 - June 17, 2016 by Mr. Reboot

Stop service:

~ $ /etc/init.d/mysql stop

Add the next parameters to he my.cnf file config:

skip-grant-tables
skip-networking

The first parameter disables grants on mysql so we can access without password to any database. If mysql was compiled with the option –disable-grant-options (not usually), setting this parameter will not work.

The second one disable network connection, by this way we can connect to mysql only from localhost.

Start mysql:

~ $ /etc/init.d/mysql start

Connect to mysql without password:

~ $ mysql -u root

Update the pasword:

mysql> use mysql;
mysql> UPDATE user SET Password=PASSWORD('new_pass') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit

And restart mysql:

~ $ /etc/init.d/mysql restart
Posted in MySQL

Post navigation

LVM Encryption with Luks

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Calendar

August 2015
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  
    Sep »

Categories

  • Apache
  • Cisco
  • Command line
  • Distros
  • Dovecot
  • File systems
  • Gadgets
  • GlusterFS
  • MySQL
  • Nginx
  • NTP
  • Opendkim
  • Pacemaker + Corosync
  • Postfix
  • Raspberrypi
  • SSH
  • SSL
  • Varnish

RSS RSS

  • Using qrencode January 16, 2022
  • Compile varnish module vmod_vsthrottle April 22, 2020
  • SSH vpn with sshuttle April 9, 2020
  • Disable swap in systemd December 16, 2019
  • Getting the parent process pid October 12, 2018
Proudly powered by WordPress | Theme: micro, developed by DevriX.