Can't connect to MySQL server on 'localhost'

This morning I opened up my computer to make a copy of my database into another laptop.

When I tried starting up the mysql command line utility, I got an error message which told me that the MySQL server cannot be connected to.

The command I gave was
C:\>\xampp\mysql\bin\mysql

Can't connect to MySQL server
Here is the message I got.
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
The message does not tell you much, other than the fact that the MySQL server is not available for communication.

At first, I thought that I might have gotten the password wrong or there was a keyboard error and tried as much.

But, then it occurred to me that the MySQL service might not be on. Yes, that was the problem.

I then started up the MySQL service and then... bingo! I was able to connect to the MySQL server.

The error message Can't connect to MySQL server on 'localhost' was gone.

Speed limit in NH 48

There is some news for those using the national highway NH 48, especially the Chennai Bengaluru section.
 
There has been an introduction of speed limits for vehicles of different categories in the NH 48. There are different speed limits for cars, SUVs, autos, trucks, vans and heavy vehicles plying along the NH48.

We just happened to pass through one of these toll gates on the Chennai Bangalore section of NH 48, last Saturday, 29 October, 2016.

We noticed that there was a board indicating 3 different categories and speeds for each of these.
According to the notice board, the speed limit for autorickshaws is 60kmph, whereas trucks, vans and heavy vehicles can travel up to a speed of 80kmph, while cars, SUVs and other private vehicles can go up to a maximum speed of 100kmph.

The fine for exceeding the limit would be Rs.400/-, for first time offenders and Rs.1000/- for a repeat offence.

Our belief is that there are hidden speed guns installed along the route, which will be monitoring the speed of the vehicles passing through. These gadgets could be communicating with the next toll booth about vehicles violating the speed limit.

But, the question is, how will they know the number of the vehicle? So, it is possible that there could be cameras installed to capture the number plate also, when the vehicles approach a clickable distance.

So, folks. Be warned. Drive safe, when you are taking the NH 48 or Chennai Bengaluru section of the National Highway!

How do I recover MySQL root password?

Recover MySQL root password in 5 Steps

In the rush of things, we sometimes fail to remember some important information such as wife's birthday or your MySQL password. 

Here are the steps that you may use to reset you MySQL password. For the problem of remembering wife's birthday, you will have to find your own solution. There's a solution to improve your memory, but that post will come later.

This assumes that you already have access to the computer but have misplaced your MySQL admin password.

These are the steps I followed to to reset the MySQL database server password.
Login as superuser, as root.

1. Stop the MySQL server process.
# /etc/init.d/mysql stop

Output:
Stopping MySQL database server: mysqld.

2. Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for a password.

Start the MySQL server w/o password:
# mysqld_safe --skip-grant-tables &

Output:
[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

3. Connect to the MySQL server as the root user, using the MySQL client.

# mysql -u root

Output:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

4. Set a new root password.

mysql> use mysql;
mysql> update user set password=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Note: It is important that you give password("Your new root password") and not just the "NEW-PASSWORD", which is a common mistake that happens.

5. Exit and restart the MySQL server.

Stop the MySQL server:
# /etc/init.d/mysql stop

Output:
Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended

[1]+  Done                    mysqld_safe --skip-grant-tables

Start the MySQL server and test it:
# /etc/init.d/mysql start
# mysql -u root -p

Calendar template for a bird's eye view of events

A bird's eye view of events in a calendar template

I wanted a calendar template that would show me a list of events that we have scheduled for the month, for our internal use.

I am okay with jQuery, Javascript and all, but why take the effort to re-create a wheel when it is available readily.

So, I jumped into the Google ocean and looked around for this Calendar shrimp. There were many available, but this particular module from CodexWorld.com seemed appropriate.

It is based on php, jQuery and Javascript, which is my development environment as well. It has all the requisite code in a single, simple, easy to understand piece of php file.

You would need to provide the database credentials in the file dbConfig.php. 
There is a function getCalender() in the php file functions.php, where you can make changes in the section [id="calender_section_bot"], to change cell colours and to show additional information as you find appropriate.

I made some changes to the table structure and the script to customize it to suit my requirement.

Note that you have to link to the bootstrap css, jquery js files and the custom style sheet to make it display properly.

If you do not link to bootstrap css, the alignment of the calendar will misfire.

Here is the link to the calendar template.

Build event calendar using jquery ajax php

PHP - Error 500 - Centos 7





Error 500 Internal Server Error in PHP


I have a Google Instance running Centos 7.

I had this strange Error 500 message whenever I upload a piece of php code.

When accessing through the browser, it comes up with the error message, which was loading without issues in my local machine.


 

Internal Server Error


The error was something like this.
HTTP request sent, awaiting response... 500 Internal Server Error
2016-10-18 11:28:33 ERROR 500: Internal Server Error.
I searched around and found a solution probable solution.

Somebody suggested that I execute the following command to make it right.

sudo chcon unconfined_u:object_r:httpd_config_t:s0 myfile.php

It did work though I do not know why. My guess is that it could be something to do with the newline and return values.

Notepad plus, which is the editor that I used for this purpose, has the options, Windows, Unix and Old Mac under "Edit", "EOL Conversion". My guess is that choosing "Unix/OSX format" when saving you code in Notepad plus might be another method to solve the problem.


Here is another instance where the 500 Internal server error may occur. Let us suppose you have a symbolic link to a folder that is present elsewhere in the disk. You are referring to a specific file, it may be a config file which you want to include in your php code. This error is thrown because Centos has a problem accessing the file due to non availability of rights. As you know, every object in Unix is accessible based on rights only.

How to find the exact problem for Internal server error

Our system was Unix/Centos


We can find the exact problem by looking at the httpd server logs that are created in the Apache server or Nginx or any server that you may be running.

So, what is the Centos error log file location?

In Centos, the Centos error log file path would be  /var/log/httpd/-error_log

So, if your domain is google.com and you are running your webserver in a Centos machine, then the path to your error log file would probably be  /var/log/httpd/google.com-error_log

An example error_log file would look something like this.

[Tue Oct 18 11:35:28.950158 2016] [:error] [pid 15013] [client 172.xx.xx.49:33929] PHP Warning:  include(/home/ghost/rider/tajmahal.php): failed to open stream: Permission denied in /home/ghost/rider/opendata.php on line 3
[Tue Oct 18 11:35:28.950188 2016] [:error] [pid 15013] [client 172.68.146.49:33929] PHP Warning:  include(): Failed opening 'tajmahal.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/ghost/rider/opendata.php on line 3


If you look in the above log, it becomes obvious where the error lies. 

Hope it helped. 

The Perils of ECR Chennai

The East Coast Road!

It is advertised as a route with scenic splendour. It can take you from Chennai to Pondicherry in no time. It can also take you from road to heaven (or hell or wherever) in no time too.

Especially during the nights. The markers are showing their age. It is obvious that whoever is maintaining them are not too worried about a few counts lesser in the population. The government can afford a few thousands to the family of the deceased, with the chance to be in the news offering condolences to the bereaved families.

The road is dotted with invisible road blocks that are veritable death traps during the night.

These are the problems I saw during my recent travel on the ECR.
  • Reflective road paint are covered with sand and dust at most places, making the road borders invisible
  • No advance notification of road blocks ahead, which might take you by surprise/shock, leading to instant heaven or hell or whatever, according to your religious inclination. In some cases, the road blocks are setup at curves (Imagine the intelligence and road sense of whoever did it). And these road blocks do not carry reflective paint or stickers on them. These road blocks are also completely opaque, which means, you do not see the vehicles coming in the opposite direction, even during the day (unless yours is a bigger vehicle).
  • Deteriorating road quality, unsatisfactory maintenance
  • Reflective road markers that do not reflect, leading to insufficient visibility
In essence, you may wish NOT TO TRAVEL BY THE ECR DURING THE NIGHT.

If you still want to drive, do not exceed the speed of 80 kilometres per hour. It might take a little longer, but it will take you where you want to go.

STOP! Don't forward that eMail!

Today I received another one of those special mails! Chain mails, I mean. This was about how instant noodles cause cancer in you. It told me in no uncertain terms, to stop eating instant noodles. It told me that Instant noodles contain wax that is not easily expelled from your body. It is also carcinogenic and so on. It claimed that many people had died after eating instant noodles, (not instantly, I think).

I did some preliminary search and found that this particular email has been doing rounds since 2002. Imagine, a simple mail going around and around for 5 years now.

These kinds of letters come in all flavours; religious, business, medical, political, philanthropical and what not!

Irritating though they are, one still wonders how gullible and naive our readers can be that believe them. Probably, the concern that they have for others is taken advantage of. And, in any case, I do not lose anything when I forward just this one mail. Or does it affect somewhere?

One should ask oneself. How many people are using email everyday all over the world? And, if one mail is forwarded by everyone every week, just how much of bandwidth is consumed? How much of your friend's time is wasted in reading that particular mail, which he/she could use spending with the family. We could probably use that bandwidth better. And certainly not be a part of spreading misinformation and spam.

So, beware. Before you forward that next mail, try to do a little research yourself. Or, if you aren't so sure, just ignore it. You are not here to save the world. God (or if you are agnostic, Nature) will take care of it.

For some insight into the various ways that people get baited, I suggest you follow the below :
http://www.breakthechain.org

Happy surfing!

Visual Ads vs. Text Ads: Why Pictures Usually Steal the Show for Better Ad Performance

Are you ready to read convincing information on this topic? Hey. Let's have a quick chat about something super important for anyone want...

Most Popular

Copyrighted.com Registered & Protected DWYE-NHTO-NBNH-7FFM