I build a small application using PHP/MySQL. After one year of development, I fell that I need to update MySQL tables structures.
I do that using (SELECT * INTO OUTFILE) it is work in my local server but not in any user that host his application in hosting company that use some thing like cPanel ( or Control Panel that given by host company to let user manage his web page, emails,ftp account, database...etc).
That type of hosting is not giving full root access to any user cuz it is share same hardware with many other clients.
edit:
I forget to tell you that I need to do that using php script I made, to let ppl run it on their servers to make this automatically. there is no thing to do by user..... this script will do the following:
1) get a copy for all data in each table.
2) delete/Drop all tables.
3) create new tables with new structure.
4) import data again to that new labels.
Use phpMyAdmin, available from cPanel.
if it's working on your local machine then it is highly likeable that the user you are using to connect to the DB does not has all the privileges required.
You can use cron jobs for regularly exporting (dumping) your databases. Also use phpmyadmin like JohnD mentioned
Related
I'm using Laravel and I'm looking for a way to back up my database with php code. I want these backup files to be saved in paths such as other drives or usb drives (by the user's choice: so that the user enters the Windows path in the software, such as: "D: \").
I also use xampp to set up a server on Windows.
It is better to suggest if you know the standard Laravel package in this regard.
I tried https://github.com/spatie/laravel-backup. it's very good and has many options to manage your backup.
I suggest if you want to show a better report of the backups that have been taken to your user in the software. Create a table and store additional information in it and use this table to display information to the user.
Im currently developing a system using PHP and MySQL, what is required of the system is that it should allow the user be able to access the database on a standard GUI online (web browser) and should also be able to access the database offline, now can anyone help me with a method of how to make this possible.
The idea i have right now (me thinking out of the box) is using local host database manager like xampp which will be offline and an online database manager were the system will be hosted but cant figure out how will both databases be synchronized so that they stay the same.
If you want to have two databases maybe you will have to use a mirroring system. This one, wil help you to mantain the database syncronized with the database of the server with the local or not accessible database. You also can have a look at this link for more information Right way to mirror a PHP/MySQL setup
This topic has been raised a few times but even after searching and going through suggestions I haven't found a solution.
I have a PHP based website and an Android app that has to use the same database. The database is for an objective type test. The questions are created on the web using an admin panel.
The Android app needs to work offline so there is a need for one time sync when internet is available.
I have created a table in PHPMyAdmin called "database version". The Android app checks the database version using a web service. If the the version number is different it should be able to download the latest version of the database of the website and store it locally for offline access.
One of the suggestions I've come across is to convert the .sql database into .sqlite and give the download link of .sqlite to the Android app. However, converting .sql database to .sqlite using PHP doesn't seem to be easy. I've come across some shell script method but with no knowledge about that it probably doesn't work for me.
So, I'm looking for way to make sure the Android app can use the same database of the website but only require internet connection for syncing otherwise the app will work offline.
Would appreciate if I could get some directions and advise as to how to accomplish this.
Thanks!
Actually, I'm not sure If I would choose a solution that "replaces" the database when your app gets back online. I think I would build a database on the Android (SQLite), and synced with the Webdatabase (MySQL) row by row, by comparing datastamps.
Thank you for the time reading this.
I am planning on creating an Android app that is communicating with my own SQLite database server\webpage that is located on my private laptop.
I have no previous knowledge/experience with PHP nor hosting a webpage in this case.
My question is what is required to make the most basic online database server so I could easily and very basically request and fetch SQLite queries within the Android app from the database that is on my laptop.
Are there any programs I have to own?
Also my first intentions is for it to work on my local network(My Wifi at home), and then make it global.
Any help is appreciated, Thanks.
What you want to do isn't possible. SQLite is used only as a local storage i.e. a file on the local PC that is being read from. In order to do what you want to do you would need to install a database server on your laptop. MySQL is probably best as this is free for personal use.
I'd suggest getting a VPS for like £6 a month and hosting a database on there. I use Chunkhost and they seem amazing for the price. There are many tutorials for setting up a MySql database on there and administering it.
I would also suggest making it a web application first before trying to integrate it with Android, that way you're learning one thing at a time and not 2 (php/mysql and then android integration).
I am thinking of running a hosted service using Amazon Services (PHP + mySQL). What I like to do is have a site where someone registers, pays PayPal and returns to site where they will get an automated information to their mySQL account. So this mySQL account would only be used by them. They can create tables, etc.
Some questions are:
1) Is there a way to create a new mySQL account and table using a script? (PHP?)
2) Is there any open-source scripts out there that already does this that I can take apart and use?
3) If the above is not a good idea, any other suggestions.
Basically I want them to put files on their local web hosting (Hostgator, Dreamhost, etc) but be able to grab data from my database in Amazon. So I want each user to be limited to their own database and not mess with others. And they need ability to update tables.
Any suggestions & thoughts appreciated!
CREATE DATABASE, CREAT USER and GRANT commands needs a lot of privileges. You should be wary of using such an account in a web script. For one thing if a user is able to figure out your paypal call back URL, there is a possibility that he can post data directly to that url and cause mischief.
What I would suggest is for you to enter the details of the database and user accounts that need to be created into a queue (maybe held in a mysql table), and to run a scheduled task (maybe cron) to create them in the background. When you do that the script does not need to have access to an account with a high level of privileges.
As to how exactly a database and user account can be created; well you can treat them like any other queries.
CREATE USER: http://dev.mysql.com/doc/refman/5.1/en/create-user.html
CREATE DATABASE: http://dev.mysql.com/doc/refman/5.1/en/create-user.html
GRANT: http://dev.mysql.com/doc/refman/5.1/en/grant.html
This may be a job that phpMyAdmin can help with?