Useful MySQL Commands

There are a lot of usefully MySQL commands that I either don’t run enough to remember or just end up using some GUI to accomplish. Nothing against Navicat, but what kind of sysadmin would I be if I couldn’t do it at the command line as well. Anyhow, I had to do a bunch of this kind of work lately, so I thought I would write the more common commands down here so I would have them to reference.

It is generally a good idea to firewall off your MySQL port (3306) unless you are on a secure network. The downside to this is that it prevents you from using GUI tools like Navicat to connect to your database server. No problem, just use this command to SSH tunnel a connection. After doing this, you can connect to your database on localhost port 8888:

ssh -fNg -L 8888:127.0.0.1:3306 login@mysql-server

Once you have installed a new instance of MySQL, you have to change the root password:

# mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'yourhostname' = PASSWORD('newpwd');
mysql> exit

Depending on the way you handle your MySQL installation, you will most likely have to run the mysql_upgrade script after upgrades to use all the new features:

mysql_upgrade -u root –password=yourpassword

Do a thorough check to see if your tables are corrupted:

mysqlcheck -u root -p --check --extended --all-databases

Repair any corruption if it exists:

mysqlcheck -u root -p --repair --all-databases

Look at all your tables and optomize them if necessary:

mysqlcheck -u root -p --optimize --all-databases

Bush Has Record Low I.Q.

Everyone knows that George W. Bush is a blithering idiot, but now we finally have some data, albeit fake, to back it up.

Apparently the Lovenstein Institute (does not actually exist) has been tracking presidential I.Q. for some time and George W. Bush is right where he belongs at the bottom of the barrel. Coming in at 91, he’s just slightly dumber than his father who managed to come out some seven points ahead of him at 98.

It turns out that this is a hoax, but it makes for a pretty funny story anyhow…

Via the Original source:

Since 1973, the Lovenstein Institute has published its research to the educational community on each new president, which includes the famous “IQ” report among others. There have been twelve presidents over the past 50 years, from F.D. Roosevelt to G.W. Bush, who were rated based on scholarly achievements, writings that they produced without aid of staff, their ability to speak with clarity, and several other psychological factors, which were then scored using the Swanson/Crain system of intelligence ranking.

The study determined the following IQs of each president as accurate to within five percentage points:

In order by presidential term
147 Franklin D. Roosevelt (D)
132 Harry Truman (D)
122 Dwight D. Eisenhower (R)
174 John F. Kennedy (D)
126 Lyndon B. Johnson (D)
155 Richard M. Nixon (R)
121 Gerald Ford (R)
175 James E. Carter (D)
105 Ronald Reagan (R)
098 George Bush (R)
182 William J. Clinton (D)
091 George W. Bush (R)

In IQ order
182 William J. Clinton (D)
175 James E. Carter (D)
174 John F. Kennedy (D)
155 Richard M. Nixon (R)
147 Franklin D. Roosevelt (D)
132 Harry Truman (D)
126 Lyndon B. Johnson (D)
122 Dwight D. Eisenhower (R)
121 Gerald Ford (R)
105 Ronald Reagan (R)
098 George Bush (R)
091 George W. Bush (R)

The six Republican presidents of the past 50 years had an average IQ of 115.5, with President Nixon having the highest at 155. President G.W. Bush rated the lowest of all the Republicans with an IQ of 91. The six Democrat presidents had IQs with an average of 156, with President Clinton having the highest IQ, at 182. President Lyndon B. Johnson was rated the lowest of all the Democrats with an IQ of 126. No president other than Carter (D) has released his actual IQ, 176 (rated as 175 by the Lovenstein Institute).

Among comments made concerning the specific testing of President GW Bush, his low ratings are due to his apparently difficult command of the English language in public statements, his limited use of vocabulary (6,500 words for Bush versus an average of 11,000 words for other presidents), his lack of scholarly achievements other than a basic MBA, and an absence of any body of work which could be studied on an intellectual basis. The complete report documents the methods and procedures used to arrive at these ratings, including depth of sentence structure and voice stress confidence analysis. “All the Presidents prior to George W. Bush had a least one book under their belt, and most had written several white papers during their education or early careers. Not so with
President Bush,” Dr. Lovenstein said. “He has no published works or writings, which made it more difficult to arrive at an assessment. We relied more heavily on transcripts of his unscripted public speaking.”

The World Needs Fewer Cops

About a year ago, I was pulled over and given what I consider to be a frivolous ticket. I managed to beat it in court, but it got me thinking about how many police we have dedicated to making sure nobody is doing anything “wrong” with their car or skateboarding where it is prohibited. It seems that the vast majority of the police force is out patrolling roads rather than actually helping the people who need it or stopping real crimes.

Speed limits have not substantively changed since the 1950′s despite the fact that our vehicles have improved immeasurably in terms of breaking and handling ability. Why is this? Just follow the money. Think of all the tickets that are written each day. Think about how much those tickets cost, and then consider the fact that only 3% of all citations are contested in courts. This pretty much just amounts to a huge tax that only a tiny fraction of Americans seem to question.

In fact, because of all the fear mongering out there, most citizens have been deluded into thinking we need even more cops to “protect our safety” by pulling over even more terrifying criminals who are endangering our society by driving with a headlight out, or going 5 mph over the speed limit. Can you detect my sarcasm? Good! To me, if our cops don’t have anything better to do than set up speed traps and give kids a hard time for riding their roller blades, we have far too many of them as it is.

After getting that ticket, and before I beat it in court, I wrote this letter to my Governor, local and state representatives. Not a single one of them wrote me back. I imagine that they have all joined in society’s collective fear, and just didn’t know what to think about a person who is asking for fewer, rather than more police.

I am writing this letter to ask that you please investigate any and all means to prevent drug trafficking within the state of Vermont. Drug abuse is a major problem, and controlling it will undoubtedly have a positive influence on the quality of life in this state.

Having said that, I am asking that you please evaluate alternative options to hiring more state troopers. The reasons I am asking this of you are two-fold. First, we find ourselves facing unprecedented budgetary challenges, and with each new officer costing tax payers roughly $70,000 for the first year alone, creating more police positions is simply not fiscally responsible at this time. Secondly, it frequently appears that the state police we do have often lack enough work to keep them busy. Countless examples exist of officers issuing frivolous tickets, or hassling folks who are doing nothing illegal, or even suspicious, but who don’t quite fit the mold.

I moved to Vermont from New Hampshire because I value my freedom, my individuality, and my right to be left in peace. Even though it is an unintended consequence of otherwise well-meaning initiatives, it is my experience that a larger police presence can’t help but run counter to these values we share as Vermonters.

Please don’t impose more financial obligations on an already over-taxed state. Please help preserve the sanctity we share as law-abiding citizens. Finally, please impose tough, no-nonsense sentencing standards upon those involved in the illicit drug trade, but don’t ask tax payers to fund a larger police presence that is likely to spend nearly all of it’s time patrolling roads, not removing the drugs from our streets.

Thank you very much for your time.

After thinking more about it, perhaps a better way to go about reducing the number of cops would be to lobby for higher salaries. If we demand that our police officers are paid more, the departments will be able to retain fewer of them… It would keep Mr. and Mrs. Paranoid feeling secure, and we could be more selective in the type of troopers we are hiring.

Chavez Donates Oil to America’s Poor

My Father watches Fox News, so I’m pretty clear on the miserable slant to their reporting. I have to say, however, that I was a bit surprised to find that despite his hours in front of the Republican Propaganda channel, he had never heard anything about Hugo Chavez offering to donate oil to America’s poor in Boston and New York. I guess that just goes to show how Rupert Murdoch’s politics corrupt the reporting on this “news” channel.

My father didn’t even believe me when I mentioned it to him. Well, here is a section from an interview with Chavez where he speaks about his offer to the US. Is it just me, or is it a little strange that the richest, most powerful country in the world is somehow unable to help its own people pay for heat, but the leader of a small nation like Venezuela can? Apparently New York is happily accepting the offer.

JUAN GONZALEZ: Mr. President, welcome. Bien venido a los Estados Unidos. Your democratic revolution has a different aspect to it, in that your rich in oil, and the world badly needs oil. What do you do in Latin America to use oil as a weapon to assist the poor. Can you tell us a little more about what you are offering to the communities of the United States who are also suffering from high oil prices.

PRESIDENT HUGO CHAVEZ: This is the result of our awareness, that only through integration we can advance and we can progress among Latin American countries, breaking the paradigm of capitalism, of free trade, and neo-liberalism. In the year 2000, we started a cooperation program especially with the Caribbean and Central American countries, and some of the South American countries, with the Caracas Energy Accord, and there for the first time in history we included Cuba, because Cuba is considered like a country that is not part the Americas, and we think it is part of the Americas; Jamaica, nicaragua, grenada, many countries.

This mechanism includes the sale of oil and oil by-products with a discount of up to 25 percent. This discount becomes in the end a donation we give these countries, however, when the price of oil, starts increases, in the year 2000 we signed the Caracas Accord and the price at that time was 20, 25 dollars a barrel. When we realized that the prices started to increase and it goes beyond 40 and beyond 50, and I doubt very much the price is going to drop any time soon because this is part of the structural crisis, the world has to face it, it is a reality. There is a drop in the oil reserves, there is an increase in consumption and demand. The refining capacity is low.

The consumerism of the world is unbearable. The world of the U.S. people must come to understand, how this country with 5 percent of the world population only, consumes 25 percent of the oil and the energy of the world. I mean that type of consumption is totally unbearable and this planet cannot stand it any more. When we realized that the price of oil went up beyond 50 dollars, we initiated another cooperation scheme. We have created, therefore, Petrocaribe and we are going to start with small Caribbean and Caricom countries, and the larger Antillas such as Cuba, Jamaica, and Dominican Republic.

So we’re now providing, first we’re ensuring the supply of oil, direct supply of oil from state to state, in order to avoid the speculation of multinationals and traders. They buy gasoline in Venezuela and then they go to a Caribbean country, and they charge double so we are selling the products to the states directly. We are not charging for freight, we assume the cost of freight. But apart from that, this discount is not of 25 percent it goes to 40 percent of the total, and this money will be paid back in 25 years time, with 2 years of grace and 1 percent interest rates. So if you make all of the mathematical calculations, the donation percentage is almost 70 percent because it’s a long term adjusted 1 percent. So what Venezuela’s doing is supplying 200,000 barrels of oil to the Caribbean and other Central American and South American countries such as Paraguay, Uruguay and smaller nations in South America. 200, 000 millions of barrels, if you apply calculations, mathematical calculations by 1.5 percent of our GDP, 1.5 percent of the GDP is devoted to this cooperation. It means we are financing these sister nations that next year will reach 1.7 billion dollars a year, in 10 years is 17 billion dollars. It’s a way for us to share, to share our resources with these countries.

And what about the us population? Well after many meetings with the U.S. citizens, we decided to propose a scheme for poor populations and low-income populations in the us. We’ve seen that poverty in the us is growing everywhere. It’s close to 11 percent poverty according to some estimates and instead of the figures you have to go deeper into it because if you see Katrina, and you saw what’s happened, 100,000 people were abandoned and they are abandoned, and they’re just surviving.

So here we have CITGO, this oil company. We have the CITGO company here in the United States. This is a Venezuelan company, so let’s have a look at the U.S. map the distribution area of CITGO in the U.S. We are present in 14,000 gas stations in the U.S., and here we have a different refineries, asphalt refineries, eight refineries that we have in the U.S., the plants for filling units, the third, refineries, terminals, and so on.

We want to use these infrastructures to help the poor populations. We have made some progress. We have given instructions to the president of CITGO, Felix Rodriguez. We want that up to 10 percent we refine here. We supply every day to the us 1.5 million barrels of oil, crude and product and we refine, here, close to 800,000 barrels a day refined here in the us. So we would like to take 10 percent of what we refine those products and to offer these products in several modalities to the poor populations. And the pilot project will be starting in Chicago we are already operating in Chicago. Well let’s hope that there’s not going to be any obstacle by the government opposed to this project being implemented, but we will be working in those poor populations. We have some allies, local partners and we have a number of communities, and we are going to donate some heating oil, because the winter is close, and for the school transportation to school, for the Mexican neighborhood which is the largest in Chicago, La Villita, is the name of this neighborhood with close to 900,000 inhabitants, and so there are other neighborhoods with Hispanics and Latinos. October, the 14th we’re going to start with these pilot projects with small communities and schools, but there are other pilot projects that will start in November in Boston, and here in New York.

So different modalities, with local authorities, mayors, organized communities, religious groups. So we are very pleased to announce this. And to help just with a drop, and a grain of contribution to help these low-income populations, Blacks or Hispanics or also White population so we’re just starting with this project.

Republicans Love to Rewrite History

Sure you say… We all know how much Republicans love to rewrite history. The Bush administration has been little but a series of lies and coverups since 2000, but I have to say that I wholeheartedly agree with Erich’s assessment over at pigeffer.com.

The long and short of Erich’s article is that Bush and Dick Cheney are angry about their approval ratings going down the toilet. They are so fed up by all the recent congressional critisisim over their pet war in Iraq that they are lashing out against Democrats and accusing them of “rewriting history”.

Erich, of course, asks the obvious question: What about the volumes of history the Bush administration has rewritten? The few members of his administration who can write, that is. This administration has been not only incredibly secretive, they have changed their reasoning for taking America to war three times, and attempted to bring the time-honored tradition of torture back to international affairs…

Hey, torture! Great family values people!

Here are some of the highlights from Erich’s article:

The latest Newsweek poll is showing that Bush’s approval ratings are below 36%, so in an effort to appear to be presidential, Bush is swinging back at his critics by accusing them of “rewriting history”. This is perhaps the most laughable and ironic accusation the president could have offered, considering that he has altered his reasons for going to war with Iraq three times.

At the time, he justified this action by claiming that Saddam Hussein had weapons of mass destruction, and was trying to acquire more. Unsurprisingly, Bush came this conclusion only a month after the attacks in New York City on 9/11. Desperately wanting to pin the attacks on Hussein to use a driver for invasion, he was unsuccessful as all evidence pointed clearly at bin Laden.

Keeping in mind that WMD’s were not found in Iraq, and the people of the United States felt they were lied to, Bush changed his message. Instead of focusing on the weapons of mass destruction, Bush was able to successfully redirect the peoples’ attention to the fact that “Saddam is a bad guy”.

Not long after the Iraqi congress was formed, our reasons for the war changed once again. Now, we were “promoting democracy”, and apparently we still are.

Erich wraps it all up by suggesting what we should be doing with our military presence in Iraq:

The best thing we can do for our troops is to pull them out of all cities, towns, and villages in Iraq and move them to the borders. From there, we can completely secure Iraq and protect the Iraqi people from foreign terrorists, such as the hundreds that are streaming in from Syria, Jordan, Saudi Arabia, and Iran.

I can’t say that I completely agree with this approach, but I do agree that the long-term hopes for a settled Middle East are bleak at best.

Of course, the second we leave, no matter how far into the future, Iraq is going to revert back to what it’s always been: a nation of tribes warring with each other over religious differences. Maybe we shouldn’t delay the inevitable…

Well said Erich. I hope you’re wrong, but you certainly do have history on your side.

Corporate Lobbyists Sell Meetings With Bush

Apparently the Bush administration loves corporate lobbyists so much that they’ve started letting them sell meetings with the president.

From the New York Times:

WASHINGTON, Nov. 9 – The lobbyist Jack Abramoff asked for $9 million in 2003 from the president of a West African nation to arrange a meeting with President Bush and directed his fees to a Maryland company now under federal scrutiny, according to newly disclosed documents.

We’ve always known that Bush values the interest of multinational corporations above all else, but come on Mr. President, isn’t this a bit much? Allowing your corporate buddies to sell meetings with you for a whopping 9 million dollars! Hopefully you are at least living up to your record of corruption and demanding a cut.

I’ll ignore the bitter shiver of disenfranchised Americanism I just got, and move on to laugh (or is it cry) at the thought of what happens when someone calls the White House to try to get a meeting with W…

White House: Hello, White House.
Caller: Hi, I would like to meet with the President.
White House: Oh… We’ll have to direct you to his Enron office for that.
Caller: Enron office?
White House: That’s right, Enron is handling the President’s schedule now. In collaboration with members of the carlyl group of course.
White House: Bye now.

I know I should stop being amazed at how demonic and corrupt this administration is, but every time they sink to a new low it still makes me sick.

First 4 Internet and Sony – Big Brother is Watching

This clever fellow Mark Russinovich over at sysinternals.com has discovered that Sony has been selling CD’s that install a digital rights management rootkit on its unsuspecting customer’s computers. They seem to have contracted with a company called First 4 internet which produces the rootkit, and contracts it out to the recording industry.

I Googled the company name and came across this article, confirming the fact that they have deals with several record companies, including Sony, to implement Digital Rights Management (DRM) software for CDs.

I wonder if these slimy tactics will really prevent people from copying digital content, or turn former legitimate customers to piracy for fear of having malware and rootkits installed on their computers? I’m just glad I don’t use Windows.