Wednesday, September 30, 2009

mysql on Ubuntu







  • mysql -h 192.168.50.93 -P 3307 -u legui -p     (warning, you need "-p")
  • mysql --host 192.168.0.145 --port 3307 --user=search_wip -pxxxxxxxx
  • show databases 
  • use xx


  • Install
    sudo apt-get install mysql-client
    sudo apt-get install mysql-server
    Add this source to your sources.list:
    deb http://security.ubuntu.com/ubuntu hardy-security main
    do an apt-get update

  • If the mysql runs on 192.168.0.11
    sudo vi /etc/mysql/my.cnf
    then
    # skip-external-locking
    bind-address = 192.168.0.11
  • it prints this at restart:
    * Checking for corrupt, not cleanly closed and upgrade needing tables.
    It is not an error, it just says that "mysql is" Checking for...
  • to start
    sudo /etc/init.d/mysql start
    (don't forget the sudo, otherwise it fails and not very explicit in the error)
  • Enable firewall mysql ports to be open using
    sudo firestarter
    or if the server doesn't have kde
    sudo /sbin/iptables -A INPUT -i eth0 -s 192.168.0.20/24 -p tcp --destination-port 3306 -j ACCEPT
  • If running a jdbc access from the same machine on Ubuntu, do this first
    mysql -u root -p
    mysql> GRANT ALL ON GG.* TO 'root'@'192.168.0.11';
    or
    mysql> GRANT ALL ON test.* TO 'root'@'192.168.0.11' IDENTIFIED BY 'password' WITH GRANT OPTION;
    mysql> FLUSH PRIVILEGES;
    mysql> commit;
    From phpmysql, you should see a user with the following privileges:
    root 192.168.0.11 global ALL PRIVILEGES Oui
  • You can then connect through DbVisualizer (not putting the db name yet). You can then create the db
    mysql> CREATE DATABASE GG;
    mysql> CREATE TABLE j_2 ( Id int AUTO_INCREMENT PRIMARY KEY, Date Date, Myint integer, Url varchar(255) );
    mysql> commit;
    etc
  • log
    /var/log/mysql/mysql.log
  • helpful
    SHOW DATABASES;
    SHOW GRANTS FOR 'root'@localhost;
    SELECT * FROM j_3 INTO OUTFILE '/toto.txt';
  • Note: This one is a good post:
    http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html




  • To use phpmyadmin
    you need a root password:

    mysql -u root

    >UPDATE mysql.user SET Password=PASSWORD('admin') WHERE User='root'
    >FLUSH PRIVILEGES;

    Also, don't forget to create the link
    sudo ln -s /usr/share/phpmyadmin/ phpmyadmin

    /var/www/phpmyadmin/libraries$ vi config.inc.php
    $cfg['PmaAbsoluteUri'] = 'localhost/phpmyadmin/';
    $cfg['Servers'][$i]['host'] = '192.168.0.5';
    $cfg['Servers'][$i]['password'] = 'mypassword';

    Also, you may want to add the line (it seems it is 3600 sec by default)
    /etc/phpmyadmin$ vi config.inc.php
    $cfg['LoginCookieValidity'] = 10000000;

  • About export/import
    Export:
    mysql -u root -p
    mysql> use test
    mysql> select * from jg_seeds_3 INTO OUTFILE '/tmp/jg_seeds_3.txt'
    Import:
    $ sudo mysqlimport -u root -p GG /tmp/jg_seeds_3.txt
    -> password (mysql pw)
    Please note that the file base name jg_seeds_3 has to match the table name in GG. The file extension (txt here doesn't matter). Put the input file in /tmp since mysql user has all privileges on the folder and all its parents.
  • mysql dump
  • dump:
    mysqldump -h bo-sql-lb-master.be.p1.canon -u bill -p --max_allowed_packet=1073741824 --lock-tables=false stats_fr tb_popu > popu-all.sql
    load:
    mysql -h hostname -u user --password=password databasename < filename

    Fedora admin survival kit

  • Network config
    /usr/bin/system-config-network

    /etc/rc.d/init.d/
    /etc/sysconfig/network

    files in /etc/sysconfig/network-scripts/*

  • Upgrade from Fedora 5 to Fedora 10:
    I get the error: Error enabling swap device hdb3: No such file or directory
    The /etc/fstab on your upgrade partition does not reference a valid swap partition.

    What I did is rename hdb3 by sdb3 in fstab. Then the install worked fine.
    After that, I had to change in /etc/X11/xorg.conf: Driver "i810" to Driver "vesa"

    After that I start having applications that crashed with different errors. I started to be tired of this upgrade, I decided to re-install totally. The Fedora10 installer froze when it asked me for license, no keyboard, mouse inactive (eventhough it was active in the first screen of the installer). I said OK, let's give Ubuntu a try... Using Ubuntu 8.04 I finally could install without issue, no video configuration to change, no application crashing, Ubuntu works for me.
  • Monday, September 7, 2009

    free.fr

  • PagePerso propose MySql and PostgreSQL but these have to be used from the free.fr server, cannot be accessed directly from the outside.
  • When using the db url jdbc:postgresql://sql.Free.fr/esicdtek:5432
    it seems it is not using the server name at all
  • if you want to put a public machine on your personal freebox LAN, I recommend putting the public machine on your main subnet and using a new router to create a subnet with all the other machines. See
    http://www.sangoma.com/support/tutorials/tcp_ip.html
  • Tuesday, September 1, 2009

    SSII

  • Regie: Délégation de personnel chez le client
  • Forfait: Projets que la SSII traite chez elle
  • Infogerence: cas particulier d'outsourcing, correspond aussi bien à la maintenance du parc, qu'à la gestion de projets, qu'à la sécurité informatique et même aux formations.
  • Thursday, August 13, 2009

    Heritrix 1

      About Heritrix binaries:
    • To start the Heritrix server at 127.0.0.1:8080, just right click the project on Eclipse and run it.
    • The ARC Writer crawl output goes to:
      C:\tools\Heritrix\archive-crawler\heritrix\jobs
    • Unzip IAH-20090813141952-00000-stutzmann.arc.gz with 7zip
    • run perl C:\tools\Heritrix\ArcExtractor\ArcExtractor.pl
      You get crawled files with names changed, but extensions preserved
    • change in bin/heritrix: JAVA_OPTS=" -Xmx512M"
    • You can shut down through the web interface: http://127.0.0.1:8080/
      About the dev version on Vista:
    • I build the heritrix-1.15.4.jar on Windows using "maven dist" (version 1.0.2). I get a build error that is actually related to the tests (C:\Users\toto\.maven\cache\maven-test-plugin-1.6.2\plugin.jelly), but if you comment out the tests in project.xml, the jar is fine (heritrix-1.15.4.jar in C:\tools\Heritrix\archive-crawler\heritrix\target). I had to use jdk 1.5 because jdk 1.6 would not work because of tools.jar
    • I copy the jar to a Linux heritrix 1.14.3 binary install and rename the existing heritrix-1.14.3.jar to *.old
    • I run it on Linux doing:
      "bin/heritrix --bind=/ --admin=LOGIN:PASSWORD"
    • Note that if you add a writer in the jar file, you can choose it from the web interface from:
      "Profiles", edit your profile, "Modules", and writer
      About Maven (need maven 1.0.2 for Heritrix):
    • to display all the targets:
      maven -g > toto.txt
    • List of targets are in project.xml, see "build" target
    • "dist:" postgoals are described in maven.xml
    • To add a jar like mysql, you need to add it to project.properties and project.xml

    Tuesday, July 7, 2009

    Java survival kit

    - Java2 (1998)
    - Java5 (2004): Generics and enum
    - Java6 (2006)
    • Web Services
    • All developers get first-class support for writing XML web service client applications. No messing with the plumbing: You can expose your APIs as .NET interoperable web services with a simple annotation. Not your style? Want to handle the XML directly? Knock yourself out: Java SE 6 adds new parsing and XML to Java object-mapping APIs, previously only available in Java EE platform implementations or the Java Web Services Pack.
    - Java8 (LTS, 2014 )

      - Java17 (LTS.  2021)

        - annotations

        - alternatives
          - alternatives (works with "java" and "javac")
        /usr/bin/update-alternatives --config java
        /usr/bin/update-alternatives --install

        http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre

        - To switch from open-jdk to Sun Hotspot JDK on ubuntu:
          sudo update-alternatives --set    java    /usr/lib/jvm/jdk1.7.0_67/bin/java

        - other notes
        • keywords const and goto are reserved, even though they are not currently used
        • // @formatter:off

        • JAVA_HOME when using Java11
          • in .bash_profile:       export JAVA_HOME=$(/usr/libexec/java_home)

        Monday, July 6, 2009

        Apache HTTP server on vista

        I installed apache_2.2.11-win32-x86-openssl-0.9.8i.msi on Vista on port 8080 for myself. Then, from the apache console, it tells me that there is no service, and the "start" button is disabled. The way I had to start it, is from the MS console: httpd.exe. When I start it, a Vista pop-up asks me if I want to open the firewall for this process. That's the way I start it.
        It also starts from the menu /Control Apache Server/Start Apache in Console.
        Could not start it from the "Apache Server Monitor"
        Ah also, I had to go through the security vista nightmare to add files in htdocs in Program Files.