mysql

MySql Tunel

apt-get install mysql-admin
 
# create tunel
ssh root@192.168.1.88 -L 3306:localhost:3306
 
# connect
mysql-admin -u magento -p magento -h 127.0.0.1
 
# Links
http://gss-konstanz.de/8-kerne-und-nen-typ/2007/10/26/windows-als-gastsystem-in-debian-xen/

install Java database (JDBC) driver for MySQL

sudo apt-get install libmysql-java
 
# old, manuall installation
# wget http://ftp.gwdg.de/pub/misc/mysql/Downloads/Connector-J/mysql-connector-java-5.1.6.tar.gz -P /tmp
# tar xzf /tmp/mysql-connector-java-5.1.6.tar.gz -C /tmp
# cp /tmp/mysql-connector-java-5.1.6/mysql-connector-java-5.1.6-bin.jar /opt/gwt-linux/
 
# LINKS
http://packages.ubuntu.com/feisty/libs/libmysql-java

Create GWT MySQLConn project under Netbeans

# HowTo
1. install Netbeans: http://www.panticz.de/install_netbeans
1.1 install http://www.panticz.de/install-GWT4NB
2. install GWT: http://www.panticz.de/install_gwt
3. install MySQL driver: http://www.panticz.de/install_mysql_driver
4.

GWT + MySQL + Netbeans Demo

# INFO
url : jdbc:mysql://localhost:3306/Bible
user: gwt-examples
pass: password
 
# create database and user
mysql -u root -p
create database Bible;
CREATE USER 'gwt-examples' IDENTIFIED BY 'password';
grant all on Bible.* to 'gwt-examples'@'%' identified by "password";
#grant all on Bible.* to 'gwt-examples'@'192.168.1.10' identified by "password";
#grant all on Bible.* to 'gwt-examples'@'localhost' identified by "password";
commit;
quit;
 
# get gwt examples 
cd ${HOME}
svn checkout http://gwt-examples.googlecode.com/svn/trunk/ gwt-examples
 
# fill database
wget http://ken

Install MySql

#!/bin/bash
 
sudo apt-get -y install mysql-server
 
# auto preconfigure password

MySQL Queries

-- select 10 random row from table
SELECT column FROM TABLE
ORDER BY rand()
limit 10
 
-- view all databases
show databases;
 
-- view tables from database
show tables FROM mysql;
 
-- timestamp 7 days ago
date_sub(curdate(), INTERVAL 7 DAY);

Install phpMyAdmin

LINK=http://ovh.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.0-rc1/phpMyAdmin-3.3.0-rc1-all-languages.tar.bz2
 
# download
wget $LINK -P /tmp
 
# extract
tar -xjf /tmp/phpMyAdmin-*.tar.bz2 -C /var/www
 
# rename dir
mv /var/www/phpMyAdmin-*/ /var/www/phpMyAdmin/
 
# acces phpMyAdmin on server
http://YOUR_SERVER/phpMyAdmin
 
 
#
# OPTIONALY
#
# configure
cd phpMyAdmin
cp config.sample.inc.php config.inc.php
vi config.inc.php
$cfg['blowfish_secret'] = 'terceS';
 
# configure user and db
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'YOUR_DB

Export MySQL Database

Login
mysql -u root -p

Links
phpMyAdmin - phpMyAdmin downloads

Allow access from outsice
/etc/init.d/mysql restart
#bind-address = 127.0.0.1
bind-address = 101.102.103.104
# or comment bind-address

Links
http://www.greensql.net/ - open source database firewall for MySQL and PostgreSQL
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-dat...

Do you like this page? Then support it. Please click the AD below and visit the sponsor. Thank you!

Syndicate content