[mysql] MySQL: How to reset or change the MySQL root password?

Setting MySQL Password

  1. stop MySQL database service

sudo /etc/init.d/mysql stop

  1. create a new mysqld directory

sudo mkdir /var/run/mysqld/

  1. give mysql user access

sudo chown mysql /var/run/mysqld/

  1. start MySQL in safe mode...

sudo mysqld_safe --skip-grant-tables &

  1. logon to the database server without a password

sudo mysql -u root

  1. use the default mysql database

use mysql;

  1. change the root password

update user set authentication_string=PASSWORD("New_Passwore_Here") where User='root';

  1. Save the changes

    flush privileges; exit;

  2. stop MySQL safe_mode and start MySQL default service

sudo /etc/init.d/mysql stop

sudo /etc/init.d/mysql start

  1. log back onto MySQL database using the root new password

sudo mysql -u root -p

*** Source : https://websiteforstudents.com/resetting-mysql-root-password-on-ubuntu-16-04-17-10-and-18-04-lts/

Examples related to mysql

Implement specialization in ER diagram How to post query parameters with Axios? PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver' phpMyAdmin - Error > Incorrect format parameter? Authentication plugin 'caching_sha2_password' is not supported How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Connection Java-MySql : Public Key Retrieval is not allowed How to grant all privileges to root user in MySQL 8.0 MySQL 8.0 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

Examples related to ubuntu

grep's at sign caught as whitespace "E: Unable to locate package python-pip" on Ubuntu 18.04 How to Install pip for python 3.7 on Ubuntu 18? "Repository does not have a release file" error ping: google.com: Temporary failure in name resolution How to install JDK 11 under Ubuntu? How to upgrade Python version to 3.7? Issue in installing php7.2-mcrypt Install Qt on Ubuntu Failed to start mongod.service: Unit mongod.service not found

Examples related to phpmyadmin

phpMyAdmin on MySQL 8.0 phpmyadmin - count(): Parameter must be an array or an object that implements Countable Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?' phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO) phpMyAdmin access denied for user 'root'@'localhost' (using password: NO) mysqli_real_connect(): (HY000/2002): No such file or directory How to create a foreign key in phpmyadmin #1292 - Incorrect date value: '0000-00-00' MySQL error - #1932 - Table 'phpmyadmin.pma user config' doesn't exist in engine phpMyAdmin Error: The mbstring extension is missing. Please check your PHP configuration