Archive for the MYSQL Category

Mysql Connection Settings in JSP

You can set the mysql connection to JSP by using one of the method given below :

The URL based mysql connection is

jdbc:mysql://serverip address/DATABASENAME?user=USERNAME&password=PASSWORD


< !– Database connection settings –> com.mysql.jdbc.Driver jdbc:mysql://localhost/database_name databses_user password

< !– configuration pool via c3p0–>


try {
// here we are connecting to localhost, port 3306. Change it to your db server address:port
con = DriverManager.getConnection(“jdbc:mysql://localhost:3306/databaseName”,
“root”, “secret”);
//or con = DriverManager.getConnection(“jdbc:mysql://localhost:3306/databaseName?user=
catch(Exception e){

That’s all.

How to Reset the MySQL root password on Ubuntu

If you want to reset the MYSQL root password on Ubuntu then follow the below steps :

1. Stop MySql Service on server

sudo /etc/init.d/mysql stop

2.Configure mysqld on server

sudo mysqld –skip-grant-tables &

3. Login into MySql as root

mysql -u root mysql

4. Reset old password with new

UPDATE user SET Password=PASSWORD(‘NewPassword’) WHERE User=’root’; FLUSH PRIVILEGES; exit;

Note : Replace the NewPassword with the password you want to set .

Mysql Database size shows ‘0’ in cPanel

In cPanel >> mysql databases , it shows database size as 0 even if it is not.

You just need to make  the below changes to fix  it :

[email protected] [#] vi   var/cpanel/cpanel.config
and search for following line.

disk_usage_include_sqldbs=0 ( set it to 1 instead of 0 )

then just run the command

[email protected][#] /scripts/update_db_cache

That’s  all you are done.