Wednesday, September 12, 2007

MySQL : root password reset

Here's what you need to do in case you forget the root user password of mysql.

# stop mysql service
/etc/init.d/mysql stop

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

# Connect to mysql server using mysql client
mysql -u root

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

# Stop MySQL Server
/etc/init.d/mysql stop

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

Tuesday, September 04, 2007

Web Development : Saving sessions in database

Some advantages of saving sessions in database.

1. The session data is more secure as a potential hacker must be
able to log into the database before he can access anything.
2. The use of multiple servers would not create a problem as all
session data now resides in a single central place and is accessible
by all servers.
3. It is much easier to query the database should the site
administrator require information about current sessions or current
users.

--
Regards,
Ketan