Database Error Corrections | Last Update: 6th September, 2005 Article ID: 69 |
- Introduction
- 1016 - Can't open file
1016 - Can't open file Solution
- 1030 - Got error 127 from table handler
1030 - Got error 127 from table handler Solution
- 1046 - No Database Selected
1046 - No Database Selected Solution
- Warning: mysql_connect(): Access denied for user:
Warning: mysql_connect(): Access denied for user: Solution
- Warning: mysql_connect(): Can't connect to local MySQL server through socket
Warning: mysql_connect(): Can't connect to local MySQL server through socket Solution
- Warning: mysql_connect(): Host '******' is not allowed
Warning: mysql_connect(): Host '******' is not allowed Solution
- Warning: Too many connections
- Warning: Too many connections Solution
- References
Introduction
Some common errors and faq's are listed below describing a certain database error that might be encountered and a solution to that error.
1016 - Can't open file
The following error message is shown when a database table is corrupt and can no longer be accessed nor read properly:
1016 - Can't open file '<database table name>.MYI' (errno: 145)
The error message will always be shown until the database table involved has been repaired.
1016 - Can't open file Solution
The following methods are available to repair damaged database tables, depending on whether the database server is still running or not:
- Using the "repair table" SQL statement
- Using the "myisamchk" command
The <database table name> part in the commands below must be replaced with the actual database table name as shown in the error message.
Using the "repair table" SQL statement
The following SQL statement can be executed when the database server is still running:
repair table <database table name>;
Using the "myisamchk" command
The following command, which is part of the MySQL installation, can be executed on the server when the database server is no longer running:
myisamchk /path/to/database/directory/<database table name>.MYI
References
1030 - Got error 127 from table handler
This indicates the table mentioned is corrupt.
1030 - Got error 127 from table handler Solution
Try running a repair and optimize on the table in phpMyAdmin.
1046 - No Database Selected
This indicates that either no database has been created or the wrong database name DB_DATABASE exists in the configure.php files.
select configuration_key as cfgKey, configuration_value as cfgValue from configuration
1046 - No Database Selected Solution
Check to make sure the database has been created and the catalog/includes/configure.php and catalog/admin/includes/configure.php files for correct database name.
Warning: mysql_connect(): Access denied for user:
The following error message is shown when either the username or password is incorrect for the database connection:
Warning: mysql_connect(): Access denied for user: 'username@localhost' (Using password: YES) in /home/username/public_html/shop/includes/functions/database.php on line 19
Unable to connect to database server!
Warning: mysql_connect(): Access denied for user: Solution
You will need to check with your hosting provider the username and password required to access the MySQL database and/or check the catalog/includes/configure.php and catalog/admin/includes/configure.php files for incorrect information.
Warning: mysql_connect(): Can't connect to local MySQL server through socket
The error Can't connect to ... normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket filename or TCP/IP port number when trying to connect to the server.
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
in /var/www/html/store/catalog/includes/functions/database.php on line 19
Unable to connect to database server!
Warning: mysql_connect(): Can't connect to local MySQL server through socket Solution
The following are checks for mysql to see if it is running and setup properly.
1. Start by checking whether there is a process named mysqld running on your server host.
Use ps xa | grep mysqld on Unix or the Task Manager on Windows.
2. It might also be that the server is running, but you are trying to connect using a TCP/IP port, named pipe, or Unix socket file different from those on which the server is listening. To find out what port is used, and where the socket is, you can do:
shell> netstat -l | grep mysql
3. The grant tables must be properly set up so that the server can use them for access control.
One way to determine whether you need to initialize the grant tables is to look for a `mysql' directory under the data directory. (The data directory normally is named `data' or `var' and is located under your MySQL installation directory.) Make sure that you have a file named `user.MYD' in the `mysql' database directory. If you do not, execute the mysql_install_db script. After running this script and starting the server, test the initial privileges by executing this command:
shell> mysql -u root test
4. Sometimes a simple restart of mysql will fix the problem.
References
Warning: mysql_connect(): Host '******' is not allowed
This indicates the wrong server DB_SERVER information in the configure.php files.
Warning: mysql_connect(): Host '******' is not allowed to connect to this MySQL server in *:\******\www\*****\******\includes\functions\database.php on line 19
Unable to connect to database server!
Warning: mysql_connect(): Host '******' is not allowed Solution
Check the catalog/includes/configure.php and catalog/admin/includes/configure.php files for incorrect information.
Warning: Too many connections
The following error message is shown when the maximum number of connections to the database server has been reached:
Warning: Too many connections in /path/to/osCommerce/includes/functions/database.php on line 19 Warning: MySQL Connection Failed: Too many connections in /path/to/osCommerce/includes/functions/database.php on line 19. Unable to connect to database server!
Warning: Too many connections Solution
This problem is common for shared hosting servers and requires correspondance with the server administrator.
This problem is generally not a fault of osCommerce, but can be experienced when osCommerce is installed on budget hosting servers.