# Create User CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']; # Create Database $ mysqladmin -u <username> -p create <nameOfDatabase> # Drop/Delete Database $ mysqladmin -u <username> -p drop <nameOfDatabase> # Check Process List $ mysqladmin -u root -p proc # Check Status at 5 seconds interval $ mysqladmin -u root -p -i 5 status # Dump Database $ mysqldump --opt -u <username> -h <hostname> <nameOfDatabase> -p > /path/to/file $ mysqldump --opt -u <username> -h <hostname> --all-databases -p > /path/to/file # Import Database $ mysql -h <host> -u <username> <nameOfDatabase> -p < /path/to/file GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON <dbname>.* TO <dbuser@localhost> [IDENTIFIED BY '<password>']; REVOKE ALL ON <dbname> FROM <dbuser@localhost>; CREATE DATABASE <dbname>; DROP DATABASE <dbname>; DROP TABLE <tablename1[, table2, table3...]>; # To activate new permissions FLUSH PRIVILEGES; USE <nameOfDatabase>; SHOW DATABASES; # show tables begining with the prefix SHOW TABLES LIKE 'prefix%'; SELECT * FROM <nameOfTable>; DESCRIBE <nameOfTable>; INSERT INTO <table> <username, password, name1, name2, ...> VALUES ('user', password('pass'), 'value1', 'value2' ...); CREATE TABLE <newtable> AS SELECT DISTINCT <field> FROM <oldtable>; INSERT INTO <database.table> SELECT * FROM <database.table> WHERE <field> = <value>; ALTER TABLE <tableOldName> RENAME <tableNewName>; UPDATE <tableName> SET <field1> = <newValue> [WHERE <field2> = <currentValue>];
Blogs
Some frequently used MySQL commands for reference...
Submitted by sandip on Mon, 08/30/2004 - 22:33Technical Reference eLibrary
Submitted by sandip on Tue, 08/24/2004 - 22:24Came across this great technical reference elibrary while doing some code searches on google.
Please share your findings...
- sandip's blog
- Login or register to post comments
How do I find the dynamically allocated IP address on a remote bridge ->Linux
Submitted by peterretief on Tue, 08/24/2004 - 16:02I'm sure it's obvious to someone.
How to determine the application listening to a particular port
Submitted by sandip on Sat, 08/21/2004 - 02:00For example, I run nmap and find that port 712 is open:
712/tcp open unknown
But it's easily identified:
# fuser 712/tcp 712/tcp: 2098 # ps -fp 2098 UID PID PPID C STIME TTY TIME CMD root 22098 8999 0 Aug18 ? 22:33 /usr/etc/customd # man -k customd custom (1M) - Custom daemon
- sandip's blog
- Login or register to post comments
Download images from Sony Cyber-shot DSC-F88 to Fedora Linux
Submitted by sandip on Fri, 08/20/2004 - 15:03Here is a tip/hint that could hopefully help others having some difficulty with cameras that support "PTP".
PTP is the acronym for the "Picture Transfer Protocol". That protocol has a strong standards basis, in ISO and in terms of the USB Still Imaging class specification. Many upcoming digital cameras should support it.
The vision is that there will be enough new PTP-enabled cameras that it'll be much easier for you to just use them. You won't need to install new software and deal with its quirks each time you borrow or buy a new camera. Instead, you will be able to acquire images (and other media objects), reprocess them, (cropping, turning them right side up, signing them, applying steganograpy or other image transforms, etc.) and share them (printing, web publishing, etc) using whatever tools you prefer.
Enough with the PTP jabber... and here is how:
1. Install gPhoto, a free ready to use set of digital camera software applications.
2. Plug in your camera which supports PTP via USB.
3. Change to PTP mode instead of normal usb data transfer.
4. Run the command, `gphoto2 --get-all-files` to download your images.
5. It's as easy as that !!
Installing Firefox Web Browser and some Essential Plugins for Linux...
Submitted by sandip on Thu, 08/19/2004 - 10:09Here are some notes on installing Firefox and plugins for Flash, Java and Mplayerplug-in:
Installing Firefox:
- Download the latest Firefox installer via http://www.mozilla.org/products/firefox/
- untar the archive, `tar -xvzf firefox-x.x.x-x-linux-gtk2+xft-installer.tar.gz`
- `cd firefox-installer`
- Login as root before doing the install, `su`
- Run the installer, `./firefox-installer`
- Change the destination install directory to be "/usr/lib/firefox"
- Create a Launcher on your desktop after installation.
Note: All of the .so plugin files go to the "/usr/lib/firefox/plugins" folder...
Top 10 ways to crash PHP
Submitted by himanshu on Sun, 08/15/2004 - 07:02Programming errors are of many kinds but the consequences can range from harmless to downright dangerous.
Top 10 ways to crash PHP is an interesting article that deals with such a topic for PHP.
- himanshu's blog
- Login or register to post comments
Knock Knock Knocking on Heavens Port !!
Submitted by sandip on Thu, 08/12/2004 - 21:21Port knocking is a method of establishing a connection to a networked computer that has no open ports.
Before a connection is established, ports are opened using a port knock sequence, which is a series of connection attempts to closed ports. A remote host generates and sends an authentic knock sequence in order to manipulate the server's firewall rules to open one or more specific ports. These manipulations are mediated by a port knock daemon, running on the server, which monitors the firewall log file for connection attempts which can be translated into authentic knock sequences.
Once the desired ports are opened, the remote host can establish a connection and begin a session. Another knock sequence may used to trigger the closing of the port.
Read more about it at PortKnocking.org and give it a whirl.
- sandip's blog
- Login or register to post comments
UN-deleting files in Linux
Submitted by himanshu on Sun, 07/25/2004 - 08:15I decided to investigate how easy it was to recover deleted files in Linux and came to the conclusion that using secure file deletion utilities is a must for safely deleting data. When files are removed in linux they are only un-linked but their inodes (addresses in the disk where the file is actually present) is not removed. This concept will be quite handy while recovering deleted files. Now i won't discuss specialized software but rather stick to utilities commonly present in linux distros. In this case it's the "debugfs" utility. Run "debugfs /dev/hda13" and then at the "debugfs" prompt use the command "lsdel"
HostingHacks.net: Tools to build a linux web hosting service
Submitted by sandip on Fri, 07/23/2004 - 23:06Interested in building a linux web hosting service? HostingHacks.net has some excellent documentation and an easy to follow step by step process to do so. Currently only Redhat and Fedora write-ups is available, but others are to follow...
- sandip's blog
- Login or register to post comments