Thursday, January 25, 2007

RESET MySQL root password

mysqld_safe --skip-grant-tables -u root &
UPDATE mysql.user SET Password=PASSWORD('new password')  WHERE User='root';


Thursday, January 18, 2007

restoring databases ,tables



Take a backup of the table which your looking to restore using mysqldump.
mysqldump -u<username> -p<password> <databasename> <tablename> > <path and name of the file>

ex:mysqldump -usridhar -pthajes testdb usermas > /home/sridhar/mysqldump/tablebackup.txt

where we get only usermas table backup.

for restoring to another db. use
mysql <dbname> < /home/sridhar/mysqldump/tablebackup.txt
ex: mysql restDB < /home/sridhar/mysqldump/tablebackup.txt .

Note: If restDB has already usermas table, pls drop before restoring.

Sunday, January 07, 2007

remooving dictionary in pygtl

self.windowTREE.signal_autoconnect (self)


Friday, January 05, 2007

python-mysql

#!/usr/bin/python
# import MySQL module
import MySQLdb
# connect
db = MySQLdb.connect(host="localhost", user="joe", passwd="secret",
db="db56a")
# create a cursor
cursor = db.cursor()
# execute SQL statement
cursor.execute("SELECT * FROM animals")
# get the number of rows in the resultset
numrows = int(cursor.rowcount)
# get and display one row at a time
for x in range(0,numrows):
row = cursor.fetchone()
print row[0], "-->", row[1]


-

Tuesday, January 02, 2007