# How to upgrade MySQL server from command line?

MySQLMySQLi Database

First, you need to open the CMD with the help of shortcut key Windows+R key.

After typing cmd, press the OK button. On pressing, you will get a command prompt. The screenshot is as follows −

After that, you need to reach the /bin directory. Follow the below instructions. If you are a Windows user, then use the below query to reach the /bin directory.

The query is as follows −

mysql> select @@datadir;

The following is the output displaying the path −

+---------------------------------------------+
+---------------------------------------------+
| C:\ProgramData\MySQL\MySQL Server 8.0\Data\ |
+---------------------------------------------+
1 row in set (0.00 sec)

From above, now you know the path of MySQL installation. Now reach the /bin by following the below instructions −

After reaching the /bin directory, you need to use the following command −

mysql_upgrade -u root -p –force

Now enter the password. This begins the upgradation process as displayed in the following screenshot −

The following is the screenshot displayed after the upgradation ends −

After that, you need to restart the server.

Published on 19-Mar-2019 08:18:31