Giter Club home page Giter Club logo

how-to-reset-mariadb-mysql-root-password's Introduction

How-To-Reset-MariaDB-Mysql-root-Password

How To Reset My MariaDB / Mysql root password

Step 1 — Identifying the Database Version and Stopping the Server

mysql --version

Output Should Like Below

mysql  Ver 15.1 Distrib 10.3.25-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

then stop mariadb services

sudo systemctl stop mariadb

Run Below command to run mysql /mariadb in safe mode

mysqld_safe --skip-grant-tables --skip-networking

Reload the systemd configuration to apply these changes:

sudo systemctl daemon-reload

Now start the MySQL server:

sudo systemctl start mysql

Connect to the database as the root user:

sudo mysql -u root

Tell the database server to reload the grant tables by issuing the FLUSH PRIVILEGES command:

FLUSH PRIVILEGES;

If you are using MariaDB, execute the following statement to set the password for the root account, making sure to replace new_password with a strong new password that you’ll remember:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

You’ll see this output indicating that the password changed:

Output
Query OK, 0 rows affected (0.001 sec)

exit mysql and kill the process of mysqld_safe

the start mariadb/mysql

sudo systemctl start mysql

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.