Posts

Showing posts with the label database

Set/Change/Reset Mysql Root Password on Ubuntu 9.04 (Jaunty)

Few days back I had issue with MySQL Root password on Ubuntu 9.04 (Jaunty). I was able to reset the password with following commands on terminal. 1. Stop the MySQL Server. sudo /etc/init.d/mysql stop 2. Start the mysqld configuration. sudo mysqld --skip-grant-tables & 3. Login to MySQL as root. mysql -u root mysql 4. Replace YOURNEWPASSWORD with your new password! UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;

Unicode support Java

Few days back, I was working on one project, Project was in MySql, Java. I had to do Java, MySql Connectivity. My database was in Gujarati. (Unicode, UTF-8) To do MySql database connection using Java is very easy. string url = "jdbc:mysql://ServerIPAddress:3306/DatabaseName Where, 1. jdbc : Driver specification 2. mysql : Defining MySql database is used. 3. ServerIPAddress : This is the IP Address of the database server 4. 3306 : Port 5. DatabaseName : Name of Database So I thought this is perfect for connectivity.. Oops... but garbage value displayed when I fetched data. So what to do? I had spent 1 week to find out what is the problem? Where is the problem? Finally, I found the solution, Need to pass parameter for Unicode support. Then, I used below string as connection: string url = "jdbc:mysql://ServerIPAddress:3306/DatabaseName?useUnicode=true&characterEncoding=UTF8"; and its done. useUnicode=true&characterEncoding=UTF8 : Property...