Langsung ke konten utama

Postingan

export mysql to csv with command line

First, I can give you the answer for ONE table: The trouble with all these INTO OUTFILE or --tab=tmpfile (and -T/path/to/directory) answers is that it requires running mysqldump on the same server as the MySQL server, and having those access rights. My solution was simply to use mysql (NOT mysqldump) with the -B parameter, inline the SELECT statement with -e, then massage the ASCII output with sed, and wind up with CSV including a header field row: Example: mysql -B -u root -p dbname -e "SELECT * FROM query;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > test.csv output: "id","login","password","folder","email" "8","mariana","xxxxxxxxxx","mariana","" "3","squaredesign","xxxxxxxxxxxxxxxxx","squaredesign","mkobylecki@squaredesign.com" "4","miedziak",

[sshtunnel.py:notify_exception_error:233]: Traceback (most recent call last) | Use module Crypto.Signature.pkcs1_15 instead

Recently I started getting the following error in a script that never had any problems in the past: NotImplementedError: Use module Crypto.Signature.pkcs1_15 instead There wasn’t much information related to this error in regards to Paramiko. Eventually I was able to “fix” it by running: sudo -H pip uninstall paramiko sudo -H pip uninstall pycrypto sudo -H pip install paramiko done

How to recover deleted file held open by Apache

If a file has been deleted but is still open, that means the file still exists in the filesystem (it has an inode) but has a hard link count of 0. Since there is no link to the file, you cannot open it by name. There is no facility to open a file by inode either. Linux exposes open files through special symbolic links under  /proc . These links are called  /proc/12345/fd/42  where 12345 is the  PID  of a process and 42 is the number of a file descriptor in that process. A program running as the same user as that process can access the file (the read/write/execute permissions are the same you had as when the file was deleted). The name under which the file was opened is still visible in the target of the symbolic link: if the file was  /var/log/apache/foo.log , then the target of the link is  /var/log/apache/foo.log (deleted) . Thus you can recover the content of an open deleted file given the  PID  of a process that has it open and the descriptor that it's opened on like thi

Cara melakukan SSH Port Forwarding

1. konfigurasi ssh di server forward dengan menambahkan vi /etc/ssh/sshd_config GatewayPorts yes 2. ketikan perintah di server forward /usr/bin/ssh -f -C -R Portforward:IPserverTujuan:Porttujuan usernamekita@localhost -pPortKita ping 8.8.8.8 -s1 Contoh: /usr/bin/ssh -f -C -R 2225:192.168.90.x:22 pandu@localhost -p22 ping 8.8.8.8 -s1

ORA-28001: THE PASSWORD HAS EXPIRED

Connect as sysdba to the database. [oracle@ijindbclone ~]$  sqlplus / as sysdba Run the query to set the password’s life time to unlimited. SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; Profile altered. Set a password for the locked user. SQL> ALTER USER user_name IDENTIFIED BY password; User altered. Unlock the user account. SQL> ALTER USER user_name ACCOUNT UNLOCK; User altered. Make sure your user is not locked anymore. SQL> SELECT USERNAME,ACCOUNT_STATUS FROM DBA_USERS; USERNAME ACCOUNT_STATUS ------------------------------ -------------------------------- HR                             OPEN ANONYMOUS                      OPEN APEX_040000                    LOCKED FLOWS_FILES                    LOCKED XDB                            EXPIRED & LOCKED CTXSYS                         EXPIRED & LOCKED MDSYS                          EXPIRED & LOCKED SYSTEM                         OPEN SYS                            OPEN