> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting MySQL definer issues

> Need Fast, Reliable Web Hosting? Hosting.com Is The Leader In Optimized Hosting For Any Need! Try Our Hosting Service Today!

This article discusses how to troubleshoot problems that may occur when the **DEFINER** attribute is used with MySQL stored objects (views, triggers, functions, and stored procedures).

## Problem

You may experience problems viewing or running MySQL stored objects (views, triggers, functions, and stored procedures). For example, you may receive the following error message in phpMyAdmin:

```
Error in processing request: No routine with name 'example' found in database 'example_db'. You might be lacking the necessary privileges to edit this routine.
```

Alternatively, you may experience seemingly random errors during website operation, or a loss of database functionality.

## Cause

The **DEFINER** attribute is used to specify a MySQL user account that can access a particular stored object. However, problems can occur when the MySQL user account in a **DEFINER** attribute does not match the currently logged-in MySQL user. For example, this can occur when using cPanel's phpMyAdmin, which always logs in as the primary account (cPanel) user, and not as a user-defined database user.

Similarly, this problem can occur after a site migration if the **DEFINER** attributes in the database are not updated with the new hosting environment's database users.

## Resolution

To resolve this issue, you can try to log in to the database as the database user that is referenced in the **DEFINER** attributes. (To determine the correct database user, you may need to [dump the database](/docs/import-and-export-a-mysql-database) and examine the **DEFINER** attributes.) There are several ways you can log in as different database users:

### Method #1: Use a MySQL client application

You can use a MySQL client application, such as MySQL Workbench, to log in to the database as the correct database user. You will then be able to edit and run stored objects using the right identity. For information about how to use a MySQL client application to connect to your databases, please see [this article](/docs/mysql-client-applications).

### Method #2: Use the 'mysql' command-line program

Alternatively, you can use the *mysql* command-line program to log in to the database as the correct database user. You will then be able to edit and run stored objects using the right identity. For information about how to use the *mysql* command-line program, please see [this article](/docs/connect-to-mysql-from-the-command-line).

### Method #3: Use a custom install of phpMyAdmin

If you do not want to use a MySQL client application or the command line, you can create a standalone phpMyAdmin installation on your hosting account. This custom installation enables you to log in to the database as the correct database user instead of as the primary account (cPanel) user. For information about how to create a custom phpMyAdmin installation, please see [this article](/docs/installing-phpmyadmin-on-managed-hosting-accounts).

<Note>
  Sometimes, you cannot log in to a database as the database user referenced in the **DEFINER** attributes. For example, a site that has been migrated from another hosting provider may have different MySQL naming conventions, and it may be impossible to create a database user with the correct name. In this case, you must do the following:

  1. Dump the entire database to a file. For information about how to do this, please see [this article](/docs/import-and-export-a-mysql-database).

  2. Use your preferred text editor to manually update the **DEFINER** attributes to reference a database user that you control.

  3. Import the modified database to your account. For information about how to do this, please see [this article](/docs/import-and-export-a-mysql-database).

  4. Test the new database. You should now be able to edit and run stored objects using the right identity.
</Note>

## More information

For more information about definers, please visit [https://dev.mysql.com/doc/refman/8.0/en/stored-objects-security.html](https://dev.mysql.com/doc/refman/8.0/en/stored-objects-security.html).

## Related articles

* [MySQL views](/docs/mysql-views)

* [MySQL triggers](/docs/mysql-triggers)

* [Creating and executing MySQL stored functions and procedures](/docs/mysql-stored-functions-and-procedures)
