Restore db.sql using “Source”

get to bin directory of mysql using command prompt log in to mysql run source command with file parameter Example : cd C:\mysql\bin mysql -u root -p mysql> source c:\myfile.sql https://stackoverflow.com/questions/3021062/how-to-restore-sql-file-generated-by-mysqldump-using-command-prompt  

Can’t Connect to MySQL Server Remotely on Ubuntu

by: devanswers.co MySQL by default will not allow incoming remote connections for security reasons. In this article we will edit the MySQL config file mysqld.cnf to allow remote connections. Testing a Remote MySQL Connection To test a remote MySQL connection in Linux terminal, simply replace username and hostname_or_ip with your own. mysql -u username -h hostname_or_ip -p Or via Command LineContinue reading “Can’t Connect to MySQL Server Remotely on Ubuntu”

Faceted navigation in PHP and MySQL

By: mightywebdeveloper.com In this tutorial we are going to build a simple PHP/MySQL faceted navigation from scratch. In case you don’t know what faceted navigation is (or faceted search, layered navigation), it’s the nice filtering mechanism you see on most e-commerce sites in some form or another next to the product listing (see image). With eachContinue reading “Faceted navigation in PHP and MySQL”

Install Apache + PHP + MySQL in Ubunut

We can Install Apache, PHP and MySQL in Ubuntu 3 types as bellow: When install Ubuntu Screen, please select ( [x] LAMP SERVER) Go to terminal : sudo apt-get install lamp-server^ Install all application one by one as:   1 Preliminary Note In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings mightContinue reading “Install Apache + PHP + MySQL in Ubunut”

MAMP: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

I instaled MAMP and it worked great. However, when I tried to access mysql from the shell I was getting $ mysql -u root -p Enter password: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) However, using a full path to MAMP binary worked. $ /Applications/MAMP/Library/bin/mysql -u root -p MAMP’sContinue reading “MAMP: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)”

Recover MySQL root Password

You can recover MySQL database server password with following five easy steps. Step # 1: Stop the MySQL server process. Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password. Step # 3: Connect to mysql server as the root user. Step # 4:Continue reading “Recover MySQL root Password”

MySQL Case-Sensitive Query

MySQL queries are not case-sensitive by default. Following is a simple query that is looking for ‘value’. However it will return ‘VALUE’, ‘value’, VaLuE’, etc… SELECT *  FROM `table` WHERE `column` = ‘value’ The good news is that if you need to make a case-sensitive query, it is very easy to do: SELECT *  FROMContinue reading “MySQL Case-Sensitive Query”

Data truncation: Incorrect datetime value in MySQL

Message Error in MySQL: “Data truncation: Incorrect datetime value: ‘1969-12-31 16:00:00’ for column ‘LAST_LOGIN’ at row 1” Resolution: Now, open the my.ini file located at c:program files/MySQL/MySQL Server X.x/my.ini. Add a # at the begining of the line: sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION” Type sql_mode=” on the next line and save the file. restart mysql

Select data that is not match data in another table in MySQL

We have mock up data in both table as below: Table1 ID Name 1 Mr. A 2 Ms. B 3 Mrs. C ————————————————————— Table2 ID Table1ID Name 1 3 ABC Beer 2 1 Tiger Beer And we want to select data in table1 that is not avaiable in table2, so when you want to doContinue reading “Select data that is not match data in another table in MySQL”