Archive for the ‘Database’ Category

Recovering mysql root password

Mysql
If you lost your mysql root password then try the following steps. # /etc/init.d/mysql stop # mysqld_safe --skip-grant-tables --user=root Then from another shell,connect to mysql # mysql -u root Full story

Convert Sql date to String Date

sql date
public class DateExample { public static void main(String args[]){ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");//Date format String date=null; java.util.Date utilDate=new java.util.Date(sqlDate.getTime());// your Sql date value date=formatter.format(utilDate); System.out.println("String date "+date); } } Full story

How to convert string date to sql date in java using java.util.Date

Java Logo
public class stringToSqlDate { public static void main(String args[]){ String strDate="17/12/2010"; java.util.Date dt=new java.util.Date(strDate); java.sql.Date sqlDate=new java.sql.Date(dt.getTime()); System.out.println(sqlDate); } Full story

Basic MySql Tips

mysql
1. How to set password for root account in MySQL Server?? #mysqladmin -u root password your-new-password #/etc/init.d/mysqld restart 2. How to add a new user account in MySQL Server?? From mysql frompt CREATE USER IDENTIFIED BY PASSWORD 'password'; 3. How to add privilleges ... Full story

Shellscript for mysql database backup

mysql1
Here is the sample shellscript to take backup of all batabase {code codetype=php} #!/bin/bash export DB_BACKUP="/backup/mysql_backup" Full story

MySQL dump & restore

mysql
mysqldump to create a simple backup of database.Here we are using mysqldump to backup database 'db' to dumb.sql #mysqldump -u root -p db >dumb.sql This will ask for root password.After entering the root password database 'db' dump into dump.sql Full story

MySQL inner join query

logo-mysql-1
This is the one of method to joining two tables. It returns all rows when there is at least one match in both tables Syntax of the inner join query: Full story

MySQL left join query

logo-mysql-1
This is the one of method to joining two tables. It returns all rows from the left table, even if there are no matches in the right table Full story

MySQL right join query

logo-mysql
This is the one of method to joining two tables. It returns all rows from the left table, The RIGHT JOIN keyword Return all rows from the right table (table_name2), even if there are no matches in the left table (table_name1). Full story
Copyright © 2012 CoreTimer.com|System Admin’s Reference. All rights reserved.

Switch to our mobile site