Kurinchi Blogger Scribbles …


Posts Tagged ‘MySql’

Mar 17
2013

How to fix Hibernate MySql connection timeout issue (solved)?

Last updated: March 17th, 2013

When we began creating an application using Struts2 framework with Hibernate and MySQL, we ran into a problem which was related to MySQL timing out its connection after a span of 8 hours when left unused. It conceived a lot of time at our end but we were able to nail down the issue at the end.

Steps that we had taken to correct the issue related to Hibernate MySql connection timeout problem are listed below

- Download Hibernate C3P0 and copy .jar files
- Set c3p0.properties
- Make changes to hibernate.cfg.xml
- Test MySQL connection timeout
- Hibernate, MySQL connection timeout related error messages
(more…)

Nov 24
2012

How to find the port used by mysql?

Last updated: November 24th, 2012

List the listening ports and check if mysql is listed on it.

$ netstat -tln | grep mysql

If you cannot find the port number for mysql view my.cnf file to see if you can find the port number. If you see a line “skip-networking” try commenting out the line and then restart mysql daemon.

$ vi /etc/my.cnf

[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
skip-networking

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

$ service mysqld restart

Oct 01
2012

How to install Ruby, Rails and MySQL on Ubuntu Server?

Last updated: October 1st, 2012

For this tutorial we will be using Ruby 1.9.3 and Rails 3.2.1

First thing update
$ sudo apt-get update

Next, we are going to install git, RVM which is essential for the build

$sudo apt-get install build-essential git-core curl

RVM stands for Ruby Version Manager that is used for installing and managing multiple versions of Ruby at one point of time.
(more…)

Mar 26
2011

MySQL: Default collation latin1_swedish_ci (swedish case insensitive)

Last updated: March 26th, 2011

When new fileds are created as variable characters they get stored as latin1_swedish_ci as default. To change the default collation users will have to manually select the collation of their choice from the mysql admin interface such as in the case of phpmyadmin or will have to denote it in sql queries.

To make a specific collation as the default, other option to give mysql an indication of it by having the needed collation name in my.cnf (mysql configuration) as shown below

Edit my.cnf:
[mysqld]
collation_server=latin1_general_ci

(more…)

Jan 09
2011

MySQL Database Error: Error 28 from Storage engine

Last updated: January 9th, 2011

Reason for the error is the availability of space allocated to the MySQL database in the specified partition.

Easy fix for this is to go to the PhpMyAdmin interface (via CPanel/WHM) and identify the tables which has some value in under overhead column. Select ALL those tables and choose the option “Repair table” after you ensure that there is enough space in the database.

May 20
2010

MySQL GUI tool for Data Management

Last updated: May 20th, 2010

HeidiSQL - a comprehensive tool for MySQL management which is available for Free.

Manage data tables, export/import databases, synchronise tables between databases, integrity check, database backup service management, edit database content and many more features packaged as a solution for ALL your MySQL needs.

This runs on windows platforms – WinXP/XP7 and you can download HeidiSQL from Download link
(more…)

Apr 05
2010

How to import mysql dump (.gz or .sql) into a database?

Last updated: April 6th, 2010

When moving mysql database from one server to another or, to test that the data backup works as expected we need to import mysql dump file in the testing environment.

Create the database (test-database) in the testing environment and identify the location of the .gz or .sql file.

If the mysql dump was a .gz file, you need to gunzip to uncompress the file by typing
$ gunzip mysqldump.sql.gz

This will uncompress the .gz file and will just store mysqldump.sql in the same location.
(more…)

Mar 01
2010

MySQL Clear Screen Window

Last updated: March 17th, 2010

To clear the screen content in MySQL use the command

mysql> \! clear

Usage of “\!” tells MySQL to pass the command to Linux OS to handle the request.

If you are in a Windows environment (DOS prompt), to pass the control to the OS you can use the command

mysql>system cls

Feb 05
2010

MySQL: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’

Last updated: February 5th, 2010

Reason why this error might occur:

i) Incomplete MySQL implementation
ii) MySQL setting mis-configuration

Solution:

root@myserver:/# vi /etc/mysql/my.cnf

Comment out the below line in my.cnf file to make MySQL listen on ALL interfaces
#bind-address = 127.0.0.1

root@myserver:/# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 17785/mysqld

Note that above line which indicates MySQL listening on all interfaces.

Aug 19
2009

How to Export Mysql schema, data to Access database?

Last updated: August 18th, 2009

In order for you to export data from MySQL to Access database, you need to first download MySQL ODBC connector from

http://dev.mysql.com/downloads/connector/odbc/3.51.html

(Choose MSI installer from the downloads section and install it in your machine)

After installing MySQL ODBC connector, you need to configure ODBC connector in order connect MySQL database.

1. Choose Start > settings > Control Panel > Administrative Tools. Then double click on Data Sources (ODBC)

2. Click System DSN and then press “Add” button. There will be a dialog asking you to choose new data source. Choose MySQL ODBC 3.51 driver and click Finish

3. Next you need to fill in the details that will enable ODBC drive to open the database of your choice. Give a name for the data source (e.g. MyDSN), Server name (e.g. localhost), User (e.g. sqlusername), Password (password for user sqlusername) and the name of the database to which you want to connect to in MySQL

4. Click the Test button to ensure everything works fine and as expected.

5. The DSN “MyDSN” gets created for you when you click the “Ok” button.

6. Now, go to Access and create a database (e.g. MyAccessDB)

7. In Access, click “File > Get External Data > Import > and then choose “ODBC Databases” from “Files of Type” option. This will open a new dialog window asking you to “Select Data Source”

8. From the new dialog window, choose “Machine Data Source“. This will display the DSN “MyDSN” which you have created earlier. Choose that DSN and click “Ok” to import the database from MySQL to Access database.


Valid HTML 4.01 Strict  Valid HTML 4.01 Strict