Browsing all articles tagged with mysql

How To Reset MySQL Password

If you are like me who tend to forget passwords almost every time, then this tip might help you reset your MySQL password just in case.

To begin, you must have access to the server, one that can stop and start the MySQL process, such as a root account. Sudo account can also be used, just as long that the user can control the MySQL service.

Begin the process by stopping the MySQL process. This can be done by executing /etc/init.d/mysqld stop command, but this can vary depending on how you setup your server. Also, be careful of users who might be using the MySQL service as stopping the service might disrupt their work.

Once the MySQL process is killed, execute the following command:

mysqld-safe --skip-grant-tables

This will run the MySQL process so you need to open another terminal to be able to reset the password. On the new terminal, you will now be able to login to MySQL to reset the password.

On the shell prompt of the new terminal, open the MySQL console:


mysql> use mysql;
mysql> UPDATE user SET Password=PASSWORD(‘YOUR_NEW_PASSWORD’) WHERE Host=’localhost’ AND User=’root’;
mysql> exit

This will change the password for the user ‘root’. Kill the MySQL process running in the first terminal, either by killing the PID or executing CTRL+C. Then start the process again, this time with the proper procedure:

/etc/init.d/mysqld start

Try logging in to the MySQL console using the new password:

mysql –uroot -p

You should now be able to use the new password for your MySQL.


Tip: MySQL Replication Error: Duplicate Entry for Key

I have encountered this error, which to my surprise occurred on a slave database.

error 'Duplicate entry '2355476' for key 1' on query ' INSERT INTO logs (DateStamp) VALUES (NOW())

You might be wondering how a slave database could have a duplicate entry while the master and other slaves are running just fine?

Some say that there could be an entry where it was written in the slave and then written again so the duplicate error occurred. Others say that if myisamchk was run in the master, it removed some entries and tries to create those entries again. The slave then attempts to write the same entry, but since myisamchk was not executed on the slave, the entry exists hence the duplication error.

But luckily, found myself a solution to fix the replication error:

mysql> set sql_slave_skip_counter = 1;
Query OK, 0 rows affected (0.01 sec)

mysql> slave start;
Query OK, 0 rows affected (0.00 sec)

This will skip the error and continue on with the replication. Do not forget to start the slave process afterwards.


Tip: Testing Your PHP/MySQL Connection

How to test if PHP connects to MySQL database?

There are numerous times when I have to setup Apache and PHP on a freshly installed Linux server. Considering that not only that Apache service should work, I also have to make sure that PHP and MySQL are working properly together.

Forgetful that I am, I always tend to forget what components should I have to make PHP and MySQL talk to each other. You need something like a ‘special glue’ to connect the two together and I will discuss here how to make PHP and MySQL work together for both RPM and source installation.
read more


Why Should We Take Trainings?

For the past few days, I have been thinking of enrolling myself to one of the available trainings for Red Hat Certified Engineer (RHCE) courses in Manila. Of course knowing myself, it would take me at least six months decide whether I should go with the training or not. I am also thinking if I am truly prepared for this kind of training, physically, mentally and financially.There are also a few types of trainings that can enhance our life not only with our careers but also on a personal side. There are technical trainings, management trainings, personality trainings (good for aspiring models or spokespeople) and more.

Certifications from prestigious enterprise companies like Red Hat Enterprise or CISCO is definitely a plus to anyone’s profile, providing bigger chances of getting that dream career. But, if totally unprepared, trainings and examinations can break your self-esteem, not to mention your bank. CISCO trainings at Mapua Insitute of Technology can take at least a year and may cost around Php30,000 to complete the four modules. I have taken technical training myself these past few years. The first one I had was Linux System Administration at Meralco Foundation which has definitely paved the way for me to become a Linux System Administrator. The training was OK and the lessons we had back then was very basic and the cost is really cheap. I learned a lot of things during my Linux training and I still use the notebook with my ‘newbie’ notes in it.

The next one I had was PHP-MySQL training with same institution. It is also OK, as we started with very basic modules and went on to more challenging case studies. This was a hard for me because this was the time I had to skip school because my father is already very sick. Nonetheless, I finished the final case study just in time.

Now going back to RHCE training, there is no doubt that being an RHCE attracts employers like moths to light. But this one puts really hard pressure on me. Php22,000 for an examination is a huge money and failing is not an option unless I earn Php2M a year. I also need to undergo another type of technical training for my personal use: driving lessons :) . So time management is a big factor here.

In the end, it all boils down to one: training is a very good investment and though it may be costly at first, the rewards are definitely great.



John Dvorak: The Sun-MySQL Deal Stinks

This commentary made by John Dvorak points out that the deal between Sun and MySQL favors Sun.

The move, announced earlier this week, is potentially a disaster for the entire sector for reasons I’ll outline here.

Let’s begin by putting MySQL in perspective: It’s the most competitive and biggest threat to Oracle Corp., if for no other reason than it’s cheaper, and in many applications, more practical.

It’s used extensively by the open-source community and is the engine that runs almost all the blogging software — including the successful WordPress, which is used as the blogging-content back end for the New York Times, among other large commercial enterprises.

Sun has an awful track record with its acquisitions. Here is a recent official list.

Sun’s crummy results go way back and include unique and useful products such as TOPS — a PC to Mac file-sharing OS, which was bought by Sun in 1987, then rotted from neglect.

From another perspective, you have to wonder why MySQL was sold in the first place and who orchestrated this deal.

If anyone actually knew that MySQL was up for grabs, I expect that Google, Yahoo and certainly Microsoft Corp. would have been interested, and there should have been a publicized bidding war resulting in a much higher price than $1 billion.

I’m close to being convinced that Oracle wanted to buy MySQL to kill the product, but knew that it couldn’t pull off the stunt itself. It would be too obvious, especially to European Union regulators. So it sent in a stooge to do the job.

The two companies, Sun and Oracle, have been strategic partners for years. On top of that, Sun cannot actually afford to spend a $1 billion on a company producing a mere $60 million in revenue and working outside its core competencies.

So who can afford it? Oracle, that’s who. This deal stinks from top to bottom.

So there you have it. Somehow, Dvorak made some points but then again, maybe we are overanalyzing things.

Powered by 1and1.comDomain Registrations starting at $9.98* Earn with Your BlogAdvertise @ PinoyTux

Search PinoyTux

Subscribe to Email Feeds

Enter Email Address:

Blog Lounge

Popular Posts

Recent Posts

Recent Comments

Site Stats