Archive for the “MySql” Category

The InnoDB requires access to specific files, that if are corrupted, will cause the InnoDB engine to fail to load. You will know if the InnoDB fails to load if you acess MySQL and run the following command;

show engine innodb status;

The output will be the following;
ERROR 1235 (42000): Cannot call SHOW INNODB STATUS because skip-innodb is defined

However the fix is to locate the following files in /var/lib/mysql/. Be sure to stop MySQL first before changing the files;

ib_logfile0

ib_logfile1

You can remove both the files by running the following commands. Again, be sure to stop MySQL first;

mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak

mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak

(Your MySQL pathing may vary, we are using the default MySQL install paths in this article).

After removing these files, start up MySQL;

Service mysql start or Service mysqld start.

Once the MySQL instance is started, the InnoDB will also be started as well.

Tags: ,

Comments No Comments »

This is just one of the many articles I’ve had on the back burner for months and I simply forgot about it. But a question today made me remember about it, so here it is. This is simply a test script for mysql, that will allow you to verify several things; Available open connections for Mysql or to verify if Mysql is simply down. All you have to do is create a test page with the following;

<?php
$link = mysql_connect(‘<server>’, ‘<username>’, ‘<password>’);
if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
}
echo ‘Connected successfully’;
mysql_select_db(<database>);
?>

Make sure you replace the server, username, password and database variables with your own. Save it and make it web access via  a URL. The script will either give you a blank screen if there is no available connections or if there are available connections it will state “Connected Sucessfully”. You can change that to whatever you wish to if the default “good” message is to bland, to say “All Go” or something more hip, I guess.

Its useful if you want to monitor your mysql remotely or if you have a monitoring service that checks for the text to show. If it sees the text missing, the monitor will error out and then we know there is a problem Houston.

That’s it.

Tags: ,

Comments No Comments »

The error is due to a bug in a Perl library Munin uses which causes $PATH variable to be lost, and then causes the plugin cannot find the mysqladmin program which it needs to retrieve the numbers to populate in the graphs. Uninstall and reinstall Munin Service Monitor may make it works again, however, a more permanent solution is to hardcode the path of the program, which will fix the problem. Here the guide on how to specify the path to mysqladmin to Munin.

Fix for Munin installed by cPanel/WHM

   1. Determine where is mysqladmin program located with the one of the following command:

      which mysqladmin
      type mysqladmin
      locate mysqladmin

      If should return a path to mysqladmin which looks similar or the same to /usr/bin/mysqladmin.

   2. Edit the /etc/munin/plugin-conf.d/cpanel.conf Munin configuration file, and modify the [mysql*] to look like below:
      [mysql*]
      user root
      group wheel
      env.mysqladmin /usr/bin/mysqladmin
      env.mysqlopts –defaults-extra-file=/root/.my.cnf
(more…)

Tags: , ,

Comments No Comments »

Phpmyadmin is a free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web. phpMyAdmin supports a wide range of operations with MySQL. Since Windows doesn’t include a GUI  managment tool for Mysql, you will need to install phpMyadmin to acess a GUI  rather than administratering Mysql via the command line interface.

Please be sure that your php installation already has the GD/GD2 Library, Mysql and MBString extensions active. You can see this by going to your IIS server and accessing the php test page. If you do not have one, you can make one by going to “C:\inetpub\wwwroot\ and my creating a text with the following line;

<? phpinfo(); ?>

Save the file as phptest.php.

This will allow you to goto Http://localhost/phptest.php. If you don’t see the Mysql or MBstring sections, you will need to have them enabled to proceed as phpMyadmin requires this.
(more…)

Tags: , ,

Comments No Comments »

I’ve found that in my journies, the easist way to reset a mysql password, assuming you have SSH / Shell access is to log into the server and change it. To do this, you need to do the following;

1. Login to the server via SSH.

2. Once logged in, you’ll need to modify the my.cnf file to force your mysql to skip the grant tables. This will allow you to reset mysql so you can gain access without providing the password. One of the benefits of SSH access.

The my.cnf file will look like this;

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
#skip-grant-tables  <— This is the line we add. Remove the # to enable it. Once done remove that or place the # back into place.
[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

3. Now that you added this, reset mysql.

4. Once mysql is restarted, you can gain access to it directly by typing ;

$ mysql -u root

It may ask for a password, but you can ignore it.

5. Now that you are logged in, will need to access the mysql database;

use mysql;

6. Lastly, we need to change the password by running the following;

UPDATE user SET password=PASSWORD(‘newpassword’) WHERE user=’root’;

7. Now you can remove the line in the my.cnf that we added in step 2. Once you remove it, save the configuration and restart mysql.

That’s it. The password has been changed!

Tags: , ,

Comments No Comments »