Archive for the tag 'mySQL'

Timeout error occurred when trying to start MySQL Daemon.

If you are getting the following error while trying to start MySQL service;

[root@ ~]# /etc/init.d/mysqld restart
Stopping MySQL: [FAILED]
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]

And if you are getting the following error in the MySQL log;

[root@ ~]# tail -f /var/log/mysqld.log
080503 14:30:28 [ERROR] Can’t start server: can’t create PID file: No space left on device
Number of processes running now: 0
080503 14:30:28 mysqld restarted
080503 14:30:28 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.

The issue might be due to the lack of space in the ‘/var’ partition. So you need to reduce the disk space, which should fix the issue.

[root@ ~]# df -h
[root@ ~]# cd /var
[root@ ~]# du -sch *

Using the above commands, you can see that files and folders which consumes more size. You need to delete the unwanted files or folders and try reduce the size.

Try restart the MySQL service.

[root@ ]# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]

:)

SBDavid

Upgrade MySQL system tables

Upgrade MySQL system tables

When you try to create a remote MySQL user, sometimes you may get the following the error.

ERROR 1146 (42S02): Table ‘mysql.procs_priv’ doesn’t exist

Why this error occurs?

MySQL system tables should be updated while upgrading MySQL version in the server and make sure that their structure is up to date. Otherwise, this error will occur when you create a remote user.

You can eliminate this error by executing the command in command prompt.

mysql_fix_privilege_tables –password=root_password

This command will update MySQL tables and its structure.

Note: Before executing this command, make sure that you have taken the full backup of MySQL.

SBDavid

MySQL: Access denied for user

MySQL: Access denied for user

MySQL Error : Error connecting to MySQL: Access denied for user: ‘root@localhost’ (Using password: YES)

This is mainly caused due to the fact that the user root does not have enough privileges to access the mysql databases or the password set for the user root to connect mysql was changed.

1. Start mysql using mysqld_safe

#/usr/local/etc/rc.d/mysqld stop
#mysqld_safe –skip-grant-tables &

Note:
mysqld_safe is used to start mysql server by disabling certain feature that restrict a user to access mysql. The option –skip-grant-tables is used to neglect the permission grant to different users of mysql.

2. Enter mysql prompt by just typing “mysql” and do the following

>GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY ‘newpassword’ WITH GRANT OPTION;
>FLUSH PRIVILEGES;
>\q

3. Kill all mysql processes and start mysqld

#killall -9 mysqld_safe
#killall -9 mysqld
#/usr/local/etc/rc.d/mysqld start
SBDavid

MySQL Socket Error in phpMyAdmin

MySQL Socket Error in phpMyAdmin

While accessing phpMyAdmin, you may get the following error.

#2002 - The server is not responding (or the local MySQL server’s socket is not correctly configured)

This is due to the missing socket file in the location /tmp.

The socket path which is specified in the phpMyAdmin configuration file is /tmp/mysql.sock.

$ vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php
cfg['Server']['socket'] = ‘/tmp/mysql.sock’;

If mysql.sock is missing in /tmp, then create a link to the mysql.sock file in /var/lib/mysql.

$ ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

There is also another fix for this issue.

1. Open the phpMyadmin config file “config.inc.php”.
vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

2.Locate the line:

$cfg['Servers'][$i]['host'] = ‘localhost’;

3.Replace ‘localhost’ with ‘127.0.0.1′ and save.

$cfg['Servers'][$i]['host'] = ‘127.0.0.1′;

This will also fix the issue.

SBDavid

Testing PHP-MySQL connection

Testing PHP-MySQL connection

dbHost = IP address of the remote database server.
dbname= give the database name
dbuser= database user
dbPass= the password of the user.

Add this script to your public_html (ie: name it dbtest.php) for your site and access it via browser and check whether the user is able to connect.

<?php
$dbHost = ” “;
$dbName = ” “;
$dbUser = ” “;
$dbPass =
$dbType = “mysql”;
mysql_connect($dbHost, $dbUser, $dbPass) or die(”could not connect “.mysql_error());
mysql_select_db($dbName) or die(”could not select db “.mysql_error());
echo “db selected”;
?>

« Prev - Next »