MySQL: Start, Stop, Uninstall & Reset Password - Academind
Maybe your like
As a developer, when working with MySQL, you typically focus on database commands and queries like INSERT INTO, SELECT etc.
Important
You can learn all about MySQL, Postgresql and SQL in general in our SQL - The Practical Guide course!
No prior SQL knowledge is required and you will learn all about the basics, core concepts and also explore lots of advanced concepts!
But some basic database administration knowledge also comes in handy from time to time.
This article explains how to perform some of the most important, common tasks:
Stopping a running server: Windows | macOS | Linux
Starting a server: Windows | macOS | Linux
Uninstalling MySQL: Windows | macOS | Linux
Resetting the root user password: All Platforms
Switching to the legacy password flow: All Platforms
Stopping a running server (Windows)
Important
If you started the MySQL server as a service, you can start and stop it via the Windows services tool. You find more details here.
A running MySQL server can be stopped via the mysqladmin command which was installed on your system automatically. You can find this executable in your installation directory inside the bin folder - for example C:\Program Files\MySQL\MySQL Server 8.0\bin.
You can optionally add the path to this bin directory to your Windows path environment variable (see this tutorial), so that you can access the tools inside this bin folder from anywhere on your system.
If you haven't added the bin path to your environment variable, you have to navigate into that bin folder via your system command prompt.
For example, this is how you could navigate into the installation path mentioned above:
cd "\Program Files\MySQL\MySQL Server 8.0\bin"Once you navigated into that path, you can run the mysqladmin command which is located there. Stop the running server by executing:
mysqladmin -u root -p shutdownIt will prompt you for your password and shut down the running server once you entered it.
You can then also restart the server if you want to.
#Stopping a running server (macOS)
If you installed MySQL via the official installer, you should have a new entry in your "System Preferences" (at the very bottom of the overview page). If you dive into the "MySQL" option there, you can start and stop the MySQL server via this GUI.
Besides that, you can also stop the MySQL server via the macOS terminal:
sudo /usr/local/mysql/support-files/mysql.server stop#Stopping a running server (Linux)
To stop a running MySQL server on Linux, you can run the following command:
/etc/init.d/mysqld stopAlternatively, you can also stop the running background server service by running:
service mysqld stopThat's all! You can thereafter restart the server if you want to.
Is the article helpful?
In that case, you might also find our monthly insights newsletter helpful!
We curate & share industry news, trends and anything else you need to know.
Register
By registering, you confirm that you read & accepted our privacy policy.
Register
#Starting a server (Windows)
Important
If you want to run the MySQL server as a service, you can start and stop it via the Windows services tool. You find more details here.
A MySQL server can be started via the mysqld command which was installed on your system automatically. You can find this executable in your installation directory inside the bin folder - for example C:\Program Files\MySQL\MySQL Server 8.0\bin.
You can optionally add the path to this bin directory to your Windows path environment variable (see this tutorial), so that you can access the tools inside this bin folder from anywhere on your system.
If you haven't added the bin path to your environment variable, you have to navigate into that bin folder via your system command prompt.
For example, this is how you could navigate into the installation path mentioned above:
cd "\Program Files\MySQL\MySQL Server 8.0\bin"Once you navigated into that path, you can run the mysqld command which is located there. Start the running server by executing:
mysqldIt will prompt you for your password and start the server once you entered it.
#Starting a server (macOS)
If you installed MySQL via the official installer, you should have a new entry in your "System Preferences" (at the very bottom of the overview page). If you dive into the "MySQL" option there, you can start and stop the MySQL server via this GUI.
Besides that, you can also start the MySQL server via the macOS terminal:
sudo /usr/local/mysql/support-files/mysql.server start#Starting a server (Linux)
To start a MySQL server on Linux, you can run the following command:
/etc/init.d/mysqld startAlternatively, you can also start a running background server service by running:
service mysqld start #Uninstalling MySQL (Windows)
To uninstall MySQL on Windows, make sure that your first stop the running server.
Once the server is stopped, you can uninstall MySQL via the Windows "Control Panel". Go to "Programs and Features" and select "MySQL" => "Uninstall".
Thereafter, to clean up any remaining data, make sure you can see hidden folders and then delete the following folders:
C:\Program Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
C:\Users<your-username>\AppData\Roaming\MySQL
Uninstalling MySQL (macOS)
If you installed MySQL via the official installer, you can uninstall it via the macOS "System Preferences". Go to the "MySQL" option and choose "Uinstall".
You also might want to get rid of all the related data - this article describes how that can be achieved.
#Uninstalling MySQL (Linux)
You find detailed instructions on how to completely remove MySQL on Linux in this Stackoverflow thread.
#Resetting the root user password
Forgot the password of your root database server user? No worries, you can reset it!
This article from the official documentation describes in detail, how you may reset your password on different systems.
#Switching to the legacy password flow
For some clients (e.g. the VS Code SQLTools extension), you need to switch to the "legacy" authentication flow for MySQL.
To do this, you just need to connect to your database server (e.g. via MySQL Workbench) and then run the following command there:
ALTERUSER'root'@'localhost'IDENTIFIEDWITH mysql_native_password BY'<password>';Was the article helpful?
In that case, you might also find our monthly insights newsletter helpful!
We curate & share industry news, trends and anything else you need to know.
Register
By registering, you confirm that you read & accepted our privacy policy.
Register
Tag » How To Reinstall Mysql 8
-
MySQL 8.0 Reference Manual :: 2 Installing And Upgrading MySQL
-
MySQL Installation Guide
-
Ubuntu Mysql Uninstall / Reinstall - Stack Overflow
-
How Do I Uninstall And Reinstall MySQL? - DigitalOcean
-
How To Reinstall Mysql? - Ask Ubuntu
-
Completely Uninstall OR Remove MySQL 8 From Windows 10
-
Completely Remove Or Uninstall MySQL 8 Database From Windows 11
-
How To Reinstall MySQL V5.x On Linux - NixCraft
-
How To Install MySQL 8.0 (on Windows, MacOS, Ubuntu) And Get ...
-
Uninstalling MySQL 8 - Packt Subscription
-
Cleanly Reinstall Mysql 8 | DirectAdmin Forums
-
Ubuntu 18.04 How To Install, Reinstall And Uninstall MySQL - Softhints
-
Reinstall MySql On Windows Server 2008 - Stison
-
Reinstall Mysql Database With Too Manny Errosr... - MariaDB