Archive

- Posts Tagged ‘MySQL’

NoSQL – Who should use this?

You may have heard about NoSQL a lot from past few years. Do you have a doubt about whether I should use it or not! Image: dataversity.net Here are few points about NoSQL related databases: NoSQL does not provide sql for query language. Data is not necessarily represented as fixed… (Continue)

PHP and Mysql SQL Injection Example

SQL injection is one very common attack on PHP application. Earlier PHP has magic_quotes_gpc() On by default but now after version 5.3 it will be deprecated. So, whatever security was available due to magic quotes will go after PHP version 5.3. For the attack, attacker need to know a little… (Continue)

Get XML Output from MySQL

MySQL can product XML output. Just instruct MySQL to return data as XML instead of sql. Here is how to get XML output from MySQL: /opt/lampp/bin/mysql -uroot -proot --xml -e "select post_title, post_date,guid, post_content from wt.wp_posts limit 50" > /tmp/posts.xml Options: --xml: for xml output --execute or -e: for executing… (Continue)

MySQL SELECT statement where something exists in List

Just recently I am back in development from support and development. So, I need to refresh my memory. Many times I have used implode() for checking whether something is in list or not using - Select ... where in list. This time list items was string and not numbers. So,… (Continue)

Show Current Database in MySQL

How to know which database is in use currently? For using a particular database, MySQL has <code>Use </code> statement. After you execute USE statement, by default all the query will be executed against the database mentioned in USE statement. Use database_name; For using other database after this statement, you can… (Continue)

Common But Important Mysql Commands And Queries

Here are some of the generally used queries. These are important and useful. 1. mysql –user=root mysql default user name is "root". And there is no password. 2. grant all privileges on *.* to 'sat@localhost' identified by 'satpwd' with grant option; 'sat'@'localhost' -sat is username and localhost is mysql… (Continue)

MySQL: Remove Duplicate Rows/Records from Table

How to remove duplicate entries from a table? Here are few methods for deleting duplicate rows/records from a table in mysql. The same concept will work in other database table for example, Oracle, as well. Methods of deleting duplicate records in a table:- 1. Alter table for adding unique index… (Continue)

International Languages And Character Set Required In Mysql

For international languages support utf8 is required in mysql column/field. MySQL allows to set  different character set on each different columns. MySQL 5.0 supports two Unicode character sets: UCS2 and all familiar "utf8". Each Unicode character set has similar collations available to exactly suit many languages like ucs2_persian_ci and utf8_persian_ci.… (Continue)

Client Does Not Support Authentication Protocol

Are you surprised why your mysql user-password is not working after upgradation to newer version of mysql server. Yes, It will not allow you to login in mysql server this way. Answer is simple: Just change your mysql password using old_password() function. mysql> Set password = old_password('password'); This will change… (Continue)

PHP Login and Logout Script

This is very simple Login and Logout Script. It is a simple script so that you can understand the logic and modify the script easily. No script can fulfill all your requirements in working condition so it is a small and simple script for you to modify. It has referrer… (Continue)