Wednesday, May 15, 2013

Mysql error : start: Job failed to start

start: Job failed to start Error while starting mysql 

If you are not able to start mysql because of this error, try following solutions.

Solutions :

1) There should not be incorrect bind-address in my.cnf. If you have not uncommented it intentionally to enable binding, the line should be commented. If you are not sure about the address, comment the line and restart mysql.

2) Run following command and try to start mysql.
$ sudo dpkg-reconfigure mysql-server-5.5

3) Remove logfiles and try to start mysql.
$ sudo rm -rf /var/lib/mysql/ib_logfile*

4) If mysqld_safe is running with mysql, kill mysqld_safe
$ sudo killall -9 mysqld_safe

5) If any of these solutions are not working for you, try final solution.
    Remove and re-install mysql again.
Debian based :
$ sudo apt-get --purge remove mysql-server mysql-common mysql-client $ sudo apt-get install mysql-server mysql-common mysql-client
Yum Based :
$ sudo yum --purge remove mysql-server mysql-common mysql-client $ sudo yum install mysql-server mysql-common mysql-client

phpmyadmin : Cannot start session without errors

phpmyadmin error : cannot start session without errors please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.




Open file php.ini.
apache2 (Debian, Ubuntu) : /etc/php5/apache2/php.ini 
httpd (RHEL, CentOS) : /etc/php.ini

Uncomment following line there.
If it is CentOS or RHEL :
session.save_path = "/var/lib/php/session" 
If it is debian or ubuntu :
session.save_path = "/tmp"

Restart Apache.

Saturday, May 11, 2013

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Solutions:

1) Try to change root's password. But it does let you reach on command prompt. So what will you do? Follow this.

Stop mysql first
$ service mysql stop or $ service mysqld stop

Open mysql in safe mode
$ mysqld_safe --skip-grant-tables &

Login with root
$ mysql -u root

Update root's password.
mysql> use mysql; mysql> update user set password=PASSWORD("testpassword") where User='root';

If it does not give permission to update password then Flush Privileges first.
mysql> FLUSH PRIVILEGES;

Now try to set password again
mysql> update user set password=PASSWORD("testpassword") where User='root'; mysql>quit
Now root's password has been set to testpassword.

Restart mysql and try to log-in as root.

2) Have you tried to set password for root or any individual database in phpmyadmin or using command line? If you have done this, now you are trying to open phpmyadmin or try to log-in using command line and you are getting this error.

Solution : Put the same password in config file of phpmyadmin for same user.

By default root password is blank in config file and it looks like this.
$cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = '';
Now set your password here and it will look like this.
$cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'password-goes-here';
Restart mysql.