mysql

warning: Creating default object from empty value in /web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

install phpMyAdmin

Check for current version
www.phpmyadmin.net

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.phpMyAdmin.sh -O - | bash -

#!/bin/bash

if [[ $(dpkg-query -W -f='${Version}' mysql-server) =~ 5.5 ]]; then
  # current version compatible with PHP 5.3 and MySQL 5.5
  URL=http://files.phpmyadmin.net/phpMyAdmin/4.4.10/phpMyAdmin-4.4.10-all-languages.tar.bz2
else
  # older version compatible with PHP 5.2 and MySQL 5
  URL=http://switch.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.10/phpMyAdmin-4.0.10-english.tar.bz2
fi

# set variables
FILE=${URL##*/}

# set target
if [ ! -z $1 ]; then
  TARGET=$1
else
  TARGET=/var/www
fi

# set owner
if [ ! -z $2 ]; then
  WWW_USER=$2
else
  WWW_USER=www-data
fi

# download if not already exists
[ ! -f /tmp/${FILE} ] && wget -nv ${URL} -O /tmp/${FILE}

# backup old phpmyadmin installation
[ -d ${TARGET}/phpMyAdmin/ ] && mv ${TARGET}/phpMyAdmin/ ${TARGET}/phpMyAdmin.backup.$(date "+%F_%T")

# extract
tar -xjf /tmp/${FILE} -C ${TARGET}

# rename directory to simply "phpMyAdmin"
mv ${TARGET}/phpMyAdmin-*/ ${TARGET}/phpMyAdmin/

# change owner
chown ${WWW_USER}:${WWW_USER} -R ${TARGET}/phpMyAdmin/

# todo, import tables
mysql --host=localhost --user=${DB_USER} --password=${DB_PASS} ${DB_NAME} [geshifilter- /var/www/phpMyAdmin/sql/create_tables.sql

Connect to MySQL DB

# ubuntu package
sudo apt-get install -y libmysql-java

path: /usr/share/java/mysql-connector-java.jar

# download
wget http://ftp.gwdg.de/pub/misc/mysql/Downloads/Connector-J/mysql-connector-java-5.1.12.tar.gz -P /tmp

# extract
tar xzf /tmp/mysql-connector-java-5.1.12.tar.gz -C /tmp/

# copy to your classpath
cp /tmp/mysql-connector-java-5.1.12/mysql-connector-java-5.1.12-bin.jar ~/NetBeansProjects/classpath/

# Netbeans
add Library / Jar File
select
~/NetBeansProjects/classpath/mysql-connector-java-5.1.12-bin.jar

# create tatabase
create database java;

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 Server

#!/bin/bash
 
# preconfigure password
debconf-set-selections <<\EOF
mysql-server-5.1 mysql-server/root_password_again string root
mysql-server-5.1 mysql-server/root_password string root
EOF
 
# install
sudo apt-get -y install mysql-server

MySQL Queries

-- list databases
show databases;
 
-- change database
USE mysql;
 
-- show tables in database
show tables;
 
-- show table informations
show TABLE status;
 
-- list users
SELECT USER, host FROM mysql.USER;
 
-- create DB
CREATE database db1;
grant ALL ON db1.* TO user1@localhost identified BY 'pass';
 
-- select 10 random row from table
SELECT column FROM TABLE
ORDER BY rand()
limit 10
 
-- update table (use join)
UPDATE table1
JOIN table2
ON table1.product = table2.a
SET table1.sku = table2.b
--where table1.product = 2138
 
-- view all databases
show databases;
 
-- 

Export MySQL Database

Login
mysql -u root -p

Optimize all databases
mysqlcheck --host=localhost --password=${DB_PASS} --user=${DB_USER} -o --all-databases

Links
phpMyAdmin - phpMyAdmin downloads

GUI
apt-get install -y mysql-admin

Allow access from outsice
sed -i 's|bind-address|#bind-address|g' /etc/mysql/my.cnf
/etc/init.d/mysql restart

Allow access to database magento for user dbo_magento from any host

Syndicate content