{"id":255,"date":"2024-03-08T00:27:59","date_gmt":"2024-03-08T00:27:59","guid":{"rendered":"https:\/\/webhostingdelhi.net.in\/tutorials\/?p=255"},"modified":"2024-03-08T00:29:38","modified_gmt":"2024-03-08T00:29:38","slug":"reset-mariadb-root-password","status":"publish","type":"post","link":"https:\/\/webhostingdelhi.net.in\/tutorials\/reset-mariadb-root-password\/","title":{"rendered":"How to Reset MariaDB root Password quick in Linux ?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Reset MariaDB root password in Linux is a necessary procedure when the current password is lost or forgotten, ensuring that administrators can regain control over the database system. This process involves stopping the MariaDB service, restarting it with special privileges that bypass standard authentication mechanisms, and then executing commands within the MariaDB environment to set a new root password. By doing this, it restores secure access to the database, allowing for the management and operation of databases without compromising the integrity and security of the data stored within. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This operation is critical for maintaining the overall security posture of applications and services relying on MariaDB, as the root account has full control over all databases and tables within the system. Therefore, it&#8217;s important to perform this Reset MariaDB root Password carefully and securely to prevent unauthorized access.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"538\" src=\"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/MariaDB-1024x538.jpg\" alt=\"Reset MariaDB root Password\" class=\"wp-image-256\" srcset=\"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/MariaDB-1024x538.jpg 1024w, https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/MariaDB-300x158.jpg 300w, https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/MariaDB-768x403.jpg 768w, https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/MariaDB.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Follow these steps to reset your MariaDB root password on a Linux system:<\/h2><nav><ul><li class=\"\"><a href=\"#stop-the-maria-db-service\">Stop the MariaDB Service<\/a><\/li><li class=\"\"><a href=\"#start-maria-db-in-safe-mode-with-skip-grant-tables\">Start MariaDB in Safe Mode with Skip-Grant-Tables<\/a><\/li><li class=\"\"><a href=\"#log-into-maria-db-without-a-password\">Log into MariaDB without a Password<\/a><\/li><li class=\"\"><a href=\"#reset-maria-db-root-password\">Reset MariaDB root Password<\/a><\/li><li class=\"\"><a href=\"#stop-maria-db-safe-mode\">Stop MariaDB Safe Mode<\/a><\/li><li class=\"\"><a href=\"#start-the-maria-db-service\">Start the MariaDB Service<\/a><\/li><li class=\"\"><a href=\"#verify-the-new-password\">Verify the New Password<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"stop-the-maria-db-service\"><strong>Stop the MariaDB Service<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, you need to stop the MariaDB service. You can do this by running:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl stop mariadb<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If your system uses <code>mysql<\/code> instead of <code>mariadb<\/code> for the service name, adjust the command accordingly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"start-maria-db-in-safe-mode-with-skip-grant-tables\"><strong>Start MariaDB in Safe Mode with Skip-Grant-Tables<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, start MariaDB in safe mode without granting table privileges. This mode allows anyone to connect to the database server without a password but with full privileges, which is why it&#8217;s crucial to ensure no unauthorized users have access to the server during this process.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mysqld_safe --skip-grant-tables --skip-networking &amp;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>--skip-networking<\/code> option prevents remote connections, enhancing security during the Reset MariaDB root Password process.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"log-into-maria-db-without-a-password\"><strong>Log into MariaDB without a Password<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now, connect to the MariaDB server as the root user:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql -u root<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"reset-maria-db-root-password\">Reset MariaDB root Password<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once logged in, it&#8217;s time to Reset MariaDB root Password. You can do this by running the following command. Make sure to replace <code>new_password<\/code> with your new desired password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>MariaDB 10.1.20 and newer:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">USE mysql;<br>FLUSH PRIVILEGES;<br>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>MariaDB 10.1.19 and earlier:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">USE mysql;<br>FLUSH PRIVILEGES;<br>UPDATE user SET password=PASSWORD(\"new_password\") WHERE User='root';<br>FLUSH PRIVILEGES;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After executing the appropriate command for your version, you can exit the MySQL prompt with:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">EXIT;<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/Reset-MariaDB-root-Password.jpg\" alt=\"\" class=\"wp-image-268\" style=\"width:462px;height:auto\" srcset=\"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/Reset-MariaDB-root-Password.jpg 1024w, https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/Reset-MariaDB-root-Password-300x150.jpg 300w, https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/Reset-MariaDB-root-Password-768x384.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"stop-maria-db-safe-mode\"><strong>Stop MariaDB Safe Mode<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now, you need to stop the MariaDB server that is running in safe mode. You can find the process ID (PID) and kill the process, or if you started mysqld_safe as a job in the background (with <code>&amp;<\/code> as in the command above), you can use:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo kill <code>cat \/var\/run\/mariadb\/mariadb.pid<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This command kills the MariaDB process by using the PID stored in <code>mariadb.pid<\/code>. The location of this file might vary, so adjust the path if necessary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"start-the-maria-db-service\"><strong>Start the MariaDB Service<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, start the MariaDB service normally:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl start mariadb<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"verify-the-new-password\"><strong>Verify the New Password<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Verify that you can now log in to the MariaDB <a href=\"https:\/\/www.webhostingdelhi.net.in\/vps-hosting-delhi\/\">server<\/a> with the new root password:<br><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql -u root -p<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You will be prompted to enter the new password to Reset MariaDB root Password. After entering it, you should gain access to the MariaDB shell.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"512\" src=\"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/mariadb.png\" alt=\"\" class=\"wp-image-262\" style=\"width:133px;height:auto\" srcset=\"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/mariadb.png 512w, https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/mariadb-300x300.png 300w, https:\/\/webhostingdelhi.net.in\/tutorials\/wp-content\/uploads\/2024\/03\/mariadb-150x150.png 150w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Reset MariaDB root Password in Linux is a crucial task that may be required if the current password is forgotten or needs to be updated for security reasons. This process involves specific steps to ensure a smooth recovery without compromising the integrity of the database system. First, the MariaDB service must be stopped to initiate the Reset MariaDB root Password. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then, the service is restarted with an option that allows for bypassing the standard authentication mechanisms, granting temporary elevated privileges. Within the MariaDB environment, administrators can then execute commands to update the root password securely. This procedure is essential for maintaining control over the database and ensuring that authorized personnel can continue managing and maintaining the system. Careful execution of the Reset MariaDB root Password is vital to prevent any potential security risks or unauthorized access to sensitive data stored in the MariaDB databases.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reset MariaDB root password in Linux is a necessary procedure when the current password is lost or forgotten, ensuring that administrators can regain control over the database system. This process involves stopping the MariaDB service, restarting it with special privileges that bypass standard authentication mechanisms, and then executing commands within the MariaDB environment to set [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":269,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[27,28],"class_list":["post-255","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mariadb","tag-mariadb","tag-reset-mariadb-root-password"],"_links":{"self":[{"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/posts\/255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/comments?post=255"}],"version-history":[{"count":11,"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":271,"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/posts\/255\/revisions\/271"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/media\/269"}],"wp:attachment":[{"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/media?parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/categories?post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostingdelhi.net.in\/tutorials\/wp-json\/wp\/v2\/tags?post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}