Tag Archives: MySQL

How to install PHP 7 and MySQL on EC2 Instance – Amazon

1. Install Apache 2.4 and PHP 7.0 on Amazon Linux AMI # Remove current apache & php (If you have installed a earlier version or you are having problems. Don't worry this WILL NOT remove any of your files, and it will make backup's of any config files you have). sudo yum remove httpd* php*…
Read more

Insert data into two tables of different databases on same instance

If both databases reside on the SAME MySQL server (and use the same user and password to connect). You simply establish the connection without picking a database, then put the name of the database in front of the table name like: INSERT INTO myDBname.myTableName (myKey) VALUES (myValue); If you have a connection to one database…
Read more

How to update PHP to latest version on AWS EC2

Warning: Before doing anything, make backups!   Remove old versions of PHP and Apache The old Apache and PHP versions in the server can conflict with the new install. So it is recommended to stop the web server and remove them using the commands: sudo service httpd stop sudo service mysqld stop sudo yum remove httpd* php*…
Read more

Check to see if MySQL record exists

If you have ever had script that you need to check before updating/deleteing a MySQL record here is a quick code to check: if(mysql_num_rows(mysql_query("SELECT userid FROM plus_signup WHERE id = '$userid'"))) { // Code inside if block if userid is already there }
Read more

Swapping Column Values in MySQL

If you ever need to swap column values in MySQL here is how: UPDATE TABLE s1, TABLE s2 SET s1.SWAP_A=s1.SWAP_B, s1.SWAP_B=s2.SWAP_A WHERE s1.KEY=s2.KEY Check out this article to read more.
Read more