Open MySQL root access from all hosts?

MySQLMySQLi Database

To open root access from all hosts, we need to change the database to “mysql” with the help of USE command.

The syntax of USE command is as follows −

USE anyDatabasename;

Now, I will use predefined database ‘mysql’, which is as follows −

mysql> use mysql;
Database changed

I have changed the database above. Here is the query to get root access from the entire host −

mysql> UPDATE user set host='%' where host='localhost';
Query OK, 6 rows affected (0.19 sec)
Rows matched: 6 Changed: 6 Warnings: 0
Updated on 30-Jul-2019 22:30:23