This happens to us quite often at WP Expert. A client comes to us to help with their website, is able to to give us access to the hosting, but has no idea about giving us access to the WordPress admin. In this case, we usually go through the database to add a new admin user for WordPress using PHPMyAdmin.
Alternatively, we could just find out what the main admin’s email is through the database and either change it or reset the password, but to add a new admin user for WordPress using PHPMyAdmin has a big advantage, it allows us to create our admin access directly.
First step: Open PHPMyAdmin.
Second step: Go to the table wp_users (or yourprefix_users if you used yourprefix as prefix instead of the default one). This table is in the left hand side columns with all the table names.
Third step: Click Insert in the top menu.
Fourth step: Fill in the necessary information
Fifth step: Click on the “Go” button at the right-hand side on the bottom. There should be a green box with confirmation text that appaers in case of success. Otherwise, check if you did anything wrong.
Once the first part is done, you should give that new user the right permissions in order to make him an admin.
First step: Go to the wp_usermeta table in the left hand side column menu. This table stores the attributes of the users.
Second step: Click Insert in the top menu.
Third step: Enter the following information for your new user:
Fourth step: Click on the button “Go” at the right hand in the bottom.
That’s it! You did it! You added a new user admin through the database on PHPMyAdmin. From now on, you will not be stucked from entering a WordPress install anymore.