Categories
MySQL

MySQL Error Number 1045

Connection attempts to a MySQL database can return "MySQL Error Number 1045".  This is a frustrating error, but has a reasonably simple solution.

While this solution is presented in the context of databases hosted on dreamhost.com accessed by the MySQL Administrator tool, most of the discussion is likely to apply to anyone encountering the 1045 error.

At the root of the error is the fact that the database server validates not only the user account making the request but also the machine the request is being made from.  To resolve the error it is necessary to tell the server that the machine is authorized.

The first step is determine the fully qualified host name of the machine you are accessing from.  The easiest way to do that is to google "display my host name".  This will locate sites like www.displaymyhostname.com, which will show you the fully qalified host name for your machine.  Copy this, you'll need it in a moment.

In the case of Dreamhost.com databases, log into your dreamhost.com control panel, then select MySQL databases from the menu.

Scroll down to the database you were trying to access, then to the right of the database name click the username being used.

The next page lists the databases that user has access to and the rights held on those databases.

In the "Allowable Hosts" section, add, on a separate line, the fully qualified host name you identified above.

Save the changes, and you're done.  You'll now be able to access your database.

Leave a Reply