Wednesday, November 13, 2013

How to import mysql database from terminal?

This is the best & easiest way to import mysql database using terminal/mysql console.


mysql> source /path/to/your_mysql_db.sql;

That's it. :)

Saturday, September 21, 2013

How to access MySQL via command line on Mac OS X

Accessing MySQL and running queries is pretty easy on mac units. Just follow the simple steps.

Step 1: Open terminal.app. Go to Applications > Utilities > Terminal.

Step 2: Type in cd / to go to your root directory.

Step 3: Type in the path of your MySQL.

/Applications/XAMPP/xamppfiles/bin/mysql -u root -p

Step 4: Enter your password.

Step 5. Voila! You can now run your sql queries.

Friday, September 20, 2013

How to edit hosts file in Mac OS X - Lion

The host file contains the mapping of the hostnames to IP addresses. The system will check if the URL has a relevant entry on the hosts file and get the corresponding IP address. Otherwise, it will resolves the IP address via the active DNS server connection.

To edit the hosts file, follow these simple steps:

1. Open Terminal.app
(You can find the terminal.app on your dock if you set up it there or by going to Applications > Utilities > Terminal)

2. Open the hosts file
Type the following on your newly opened Terminal.

$ sudo nano /private/etc/hosts

3. Edit the hosts file
The hosts file may contains default hostname mapping like 127.0.0.1 assigned to localhost. Simply add your hostname with its corresponding IP address. Just follow how the default mapping was set. Or you can edit one of the defaults.

4. Save the hosts file
To save the hosts file, simply press ctrl + o and hit enter. Then, ctrl + x to exit the editor.

5. Flush DNS cache
You need to flush the DNS cache so your changes will take effect. To flush the DNS cache, run the simple command,

$ dscacheutil -flushcache

But if you are just doing it locally using XAMPP, you can do it by restarting your apache server.

Voila! Test your new mapping in your browser.

Friday, September 13, 2013

Styling Placeholder using CSS3

Here is the code if you want to style your form elements' placeholders like inputs, emails, phones, textareas & etc.

::-webkit-input-placeholder {/* WebKit browsers */
color: #333;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #333;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #333;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #333;
}