Import database to mysql throught console in windows

In this example, import ‘data.sql’ file into ‘blog’ database using vivek as username:
$ mysql -u vivek -p -h localhost blog < data.sql

If you have a dedicated database server, replace localhost hostname with with actual server name or IP address as follows:
$ mysql -u username -p -h 202.54.1.10 databasename < data.sql
OR use hostname such as mysql.cyberciti.biz
$ mysql -u username -p -h mysql.cyberciti.biz database-name < data.sql

If you do not know the database name or database name is included in sql dump you can try out something as follows:
$ mysql -u username -p -h 202.54.1.10 < data.sql

you may remove the host and add the database and table like the following

$ mysql -u username -p < data.sql

Forbidden ( WAMP and Windows 8 )

المشكلة دى فى وندوز 8 الجديد … عشان تحل المشكلة دى لازم تحط ال wamp على put online  ( كليك يمين على التاسك بار ) … فهى مش ححتحل الا بالموضوع دا

wamp

Copy online WordPress blog to localhost

Before we start lets define a few things for this example:

  1. The hosted version address we will refer to as: http://www.hostedversion.com (This is the web address of the hosted wordpress site)
  2. The local version address we will refer to as: http://localhost/testsite (This is the web address of the local host folder you want to transfer your site to)

STEP 1:
Copy your files from your webhost to your local server folder.

STEP 2:
On your webhost login to phpmyadmin and export your database (By Selecting your database and selecting the export tab and downloading to your computer)

STEP 3:
Log into your local phpmyadmin, create a new database and import the sql database into it by selecting the import tab and uploading your file.

STEP 4:
Once Uploaded we want to modify the database to reflect the new blog location being on the localhost. So we run the following SQL (Select the SQL tab and paste the following code):

UPDATE wp_options SET option_value = replace(option_value, 'http://www.hostedversion.com', 'http://localhost/testsite') WHERE option_name = 'home' OR option_name = 'siteurl';

Note : 

You can change them in the wp-config and not use sql ( but sql better ) 

// define(‘WP_HOME’,’http://localhost/ithireorg&#8217;);
// define(‘WP_SITEURL’,’http://localhost/ithireorg&#8217;);

STEP 5:
We now want to fix the urls of posts and pages. So we run the following SQL:

UPDATE wp_posts SET guid = replace(guid, 'http://www.hostedversion.com','http://localhost/testsite');

STEP 6:
If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. So we run the following SQL to fix this issue:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.hostedversion.com', 'http://localhost/testsite');

STEP 7:
We want to now modify our wp-config.php file in our local server. Honestly, the easiest way to do this is to delete the wp-config.php file in your local server and then visithttp://localhost/testsite in a browser.

STEP 8:
With the dialog message that comes up click the ‘Create a Configuration File’ button. Then click the ‘Lets Go’ button on the next screen.

STEP 9:
Fill in all of the fields:
Database Name: This is the name of the database in your local phpmyadmin
Username: This is your phpmyadmin username (usually root)
Password: This is your phpmyadmin username’s password
Database Host: This is usually localhost
Database Prefix: normally is wp_ unless someone has changed it manually.

STEP 10:
Click Submit, the wp-config file will be created and everything should work on the local host.
STEP 11:
There is problem about the permalink you need to change the permalink to default again in orderthat the link work fine .

IMPORTANT UPDATE : 

To make the permalink work fine if you made custom permalink .. you have to enable mod_rewrite .. you can find it in the http.conf  and finally the problem solved

also make sure the .htaaccess file have the RewriteEngineOn .

the other way : 

Use the wordpress plugin duplicator to make that

http://wordpress.org/extend/plugins/duplicator/

file

And here is the final way to solve this problem : 

note : this is just an example

  • Make the database name and import the tables to the database
  • Only get the content folder from the wordpress website ( that all you want here )
  • get new copy for wordpress in the localhost .
  • and then make sure you enable mod_rewrite in http.conf ( IMPORTANT ) 
  • you have to change the .htaaccess file to the right directory

RewriteBase /directoryname/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /directoryname/index.php [L]

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket

Use the same configuration that you are attempting. Here is how I set it up.
su
mkdir /var/lib/mysql
cd /var/lib/mysql
ln -s /opt/lampp/var/mysql/mysql.sock

This will allow you to use tools such as mysql-query-browser without any hassles.

To access mysql from the command line:

/opt/lampp/bin/mysql -p