
How to Manage Mysql Database Users Using PHP
In this article, we will explain How to Manage Mysql Database Users Using PHP.
In MySQL, you can create user accounts with different privileges.
Root User
By default, MySQL has a superuser we called root this user has all the privileges. You can log in
as root to execute more than one MySQL admin work, also including managing users. How to Manage Mysql Database Users Using PHP
Change the Root Password
If you did not specify the root password when installing MySQL, mostly it would be empty. If the root password is empty, make sure to reset it with a secure password for security.
follow the below command to change the root password using the command line. Type your password in place of the new password. After press the Enter key, it will ask you to enter the current password. If the current password will be empty, just press the Enter key.
mysqladmin -u root -p password 'newpass
Views as Existing User
MySQL user’s details are stored in a table we called user table. In this user table, usernames are stored in a column we called the user, and hostnames are stored in a column we called the host.
Based on these facts, you can use the following command to view the username and the host
of the existing users. You need to log in as root first.
SELECT user, host FROM mysql.user;