[Solution] How to reset a MySQL root password easily

Stop the MySQL service sudo /etc/init.d/mysql stop Start MySQL without a password sudo mysqld_safe –skip-grant-tables & Connect to MySQL mysql -uroot Set a new MySQL root password Stop and start the MySQL service Log in to the database mysql -u root -p Warning mysqld_safe Directory ‘/var/run/mysqld’ for UNIX socket file don’t exists Method 2