MySQL 5.7+ Imported Database and Log Rotate or Debian Account Error

So, I imported an old database to completely replace all existing databases and user tables in a new MySQL install.
Basically a dump of all tables (including user tables) from mysqldump will dump your user table too.

mysqldump --all-databases > dump.sql

So, you have a dump including all users too, and if you import them into a new mysql install it can override the new required mysql users.

My debian-sys-maint account got removed from a new MySQL 5.7 install and the following error was showing up in my log file:


/etc/cron.daily/logrotate:
error: error running shared postrotate script for ‘/var/log/mysql.log /var/log/mysql/*log ‘
run-parts: /etc/cron.daily/logrotate exited with return code 1

So, to recreate the debian-sys-maint users, you can connect to the mysql daemon and create the user directly.
Note that with 5.7, there is no password field, so you must use the newer authentication_string instead.

First, find the password your scripts are trying to use by:

# more /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = YOURPASSWORD
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = YOURPASSWORD
socket = /var/run/mysqld/mysqld.sock

Make a note of the password field.  Next, connect to mysql, using mysql -p, and create the user, make sure to replace the YOURPASSWORD with the password copied from above.


INSERT INTO `mysql`.`user` ( `Host`, `User`, `authentication_string`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Create_user_priv`, `ssl_type`, `ssl_cipher`, `x509_issuer`, `x509_subject`, `max_questions`, `max_updates`, `max_connections`, `max_user_connections`
) VALUES (
'localhost', 'debian-sys-maint',
password('YOURPASSWORD'),
'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', '', '', '', '', 0, 0, 0, 0);
FLUSH PRIVILEGES;

Hopefully, your log update will run without problem.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Section Visitor Not Found

/usr/share/awstats/tools/update.sh
Error while processing /etc/awstats/awstats.site.com.conf
Create/Update database for config "/etc/awstats/awstats.site.com.conf" by AWStats version 7.4 (build 20150714)
From data in log file "/var/log/apache2/access.log"...
Phase 1 : First bypass old records, searching new record...
Direct access to last remembered record is out of file.
So searching it from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Error: History file "/var/www/usage/site.com/awstats/awstats08201.6site.com.txt" is corrupted (End of section VISITOR not found).
Restore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).

Note, I didn’t remove this file, but rather deleted the last few lines of corrupted data and added END_VISITOR to the last line.
Additionally, you can repair the file from the raw apache access logs.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Test Page

Test description

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Python Connection and Cursor Overloading

Overloading the Python connection and cursor for databases to trace transactions can be useful when needing to obtain SQL code that is executed. With an execute() or executemany() statement, sometimes it is helpful to grab the SQL code to test in the server directly or to be used by other programs. So, I simply override the connection and cursor classes to provide this functionality.

It can be used by:


self.conn = Connection(sqlite3.connect(self.database))
self.cursor = self.conn.cursor()

fout = None

class Cursor():
"""A wrapper for cursors to show executed queries"""

def __init__(self, curs, conn):
self.curs = curs
self.conn = conn

def printquery(self, sql, args):
s = sql
for i in range(len(args)):
#print type(args[i])
if (type(args[i]) is str) or (type(args[i]) is unicode) or (type(args[i]) is datetime):
s = s.replace(”?”,”‘{}’”, 1)
else:
s = s.replace(”?”,”{}”,1)
print >> fout, s.format(*args), “;”

def execute(self, sql, args):
self.conn.notifyexecute()
self.printquery(sql, args)
self.curs.execute(sql, args)

def executemany(self, sql, tuples):
#print sql, tuples
self.conn.notifyexecute()
for i in range(len(tuples)):
self.printquery(sql, tuples[i])
self.curs.executemany(sql, tuples)

def fetchall(self):
return self.curs.fetchall()

def fetchone(self):
return self.curs.fetchone()

class Connection():
“”"A wrapper for connections to show executed transactions”"”

def __init__(self, conn):
self.conn = conn
self.tx = 0

def cursor(self):
return Cursor(self.conn.cursor(), self)

def commit(self):
print >> fout, “COMMIT;”
print >> fout, “”
self.tx = 0
return self.conn.commit()

def notifyexecute(self):
if self.tx == 0:
self.tx = 1
print >> fout, “BEGIN;”

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Compile and Build wget on Mac OSX 10.6.8

You will need to make and install open ssl first.

curl -O http://ftp.gnu.org/gnu/wget/wget-1.14.tar.gz
tar -zxvf wget-1.14.tar.gz
cd wget-1.14/
./configure –with-ssl=openssl
make
su
make install

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Great Hubble Space Telescope Photos

http://www.theatlantic.com/infocus/2012/11/2012-hubble-space-telescope-advent-calendar/100415/?utm_source=Sailthru&utm_term=Very%20Short%20List%20-%20Daily

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Shuttle Endeavour is in Houston

Shuttle Endeavour flew over JSC several times this morning!  Everyone got some great pictures and video.

Grand D. brought Alden and Meredith down to Ellington to meet me after they got done with school and we braved the crowds and got to see the shuttle piggyback on the SCA!

The Space Shuttle Endeavour, atop the Shuttle Carrier Aircraft (SCA), took off from the Kennedy Space Center at 6:22 a.m. CDT today en route to a planned overnight stop at Ellington Field in Houston. The SCA/Endeavour is expected to arrive in the Houston area around 9 a.m. CDT and fly at about 1,500 feet altitude above various areas of the city, including downtown, Reliant Park, the San Jacinto monument. The specific route and timing of Endeavour’s flight will depend on weather and operational constraints. Landing at Ellington is expected at about 10:45 a.m. Endeavour is planned to depart for California on Thursday, Sept. 20.

https://io.jsc.nasa.gov/app/browse.cfm?cid=37262

Shuttle Endeavour Flyover

Shuttle Endeavour Flyover

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

PI&C Award

I received an award for assisting in coming up with ideas to work around some problems in software when upgrading the ISS IPF from http to https.

ISS PI&C Award

ISS PI&C Award

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Transit of Venus

Transit of Venus 2012

Transit of Venus 2012

I went home early to show the kids the transit of Venus.  We found their magnifying glass and some white cardboard and went outside.  We held the glass up to the sun and the paper a few feet away and got a nice projection of the sun onto the paper.  Alden, Meredith, Grand D., and I could venus in the upper left corner of the bright circle of the sun projected onto the paper.  Of course it’s on the opposite side from the picture since we were looking at it from a right to left reflection point of view, ie from behind the rays.

It’s the last transit of Venus for a century!  Glad we got to see it!  This reminds me of when I was in middle school.  We all went outside to see the eclipse.  We all punched a small hole in a piece of paper, folded it in half, and projected the sun onto the other side.  We each watched on our own paper as the sun was partially covered by the moon.  Very cool, and such a good memory.

Here are some more Venus transit links:

http://spaceref.com/venus/

http://www.spaceref.com/news/viewpr.html?pid=37301

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Morpheus Lander Explodes

Very sad day for Morpheus….

http://www.cfnews13.com/content/news/cfnews13/video.html?clip=http://static.cfnews13.com/newsvideo/cfn/MorpheusExplosion0809.flv

http://news.cnet.com/8301-11386_3-57490372-76/nasas-morpheus-moon-lander-crashes-and-burns/

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz