Like suppose i have a domain named "abcd.com"
and in that domain i have a phpmyadmin database installed.i have a main.php file too
how to initiate the connect from main.php file to a particular api function(which will update a value in the phpmyadmin database)?
There's a bit of confusion.
You should understand that PhpMyAdmin is a "webapp" as much as the one that your writing main.php.
So, if you have the information about any PhpMyAdmin account, that one is the same as you DB's user.
You can use this information inside you main.php file to connect to the DB and "do stuff", as long as the main.php is in the same server that PhpMyAdmin.
Related
I have to update (move) actual database (exported as .sql from phpMyAdmin) to new one (already imported, same as old database). Problem is that, when I update file wp-config.php to new database (I just updated dbname, user, password and server), then it show up installation. When I set it back to old databse, it works OK. So, there is something that I need to update in DB? It seems like there would by any option about installation? Not sure, because new databse is well-filled.
So there is this neat tool I like to use when migrating the entire installation that I've developed locally.
Search Replace DB
Say you've developed everything locally, and even put the content in. Naturally WordPress will populate database with local links - something like
http://localhost/wp-content/uploads....
But when you move this to a new WordPress installation (clean), you cannot just import the exported .sql database, because it contains the old links with your localhost in it.
So that's why you first copy your old installation to the new server, then import the database, and then create a folder called sr where you put in the aforementioned script.
Now it's important not to open the newly copied WordPress installation once you've imported the database, because you'll get mixed links, and it could get messed up here.
Instead go to the /sr folder on your live site
http://www.yoursite.com/sr
And you'll see a search and replace screen.
There, just change
localhost -> www.yoursite.com
or whatever the equivalent to your localhost might be, in my case it's usually IP address of the test server I am developing.
Your database details like name, username and password should be pulled from the wp-config.php file.
Then just click dry run. This will show you all the replaced links in the database. Then you can inspect to ensure that you've correctly replaced the links - you only need to change the 'base' of the link. The path to uploads folder, for instance, should remain the same (remember, you've copied the entire wp-content folder to your live server).
If you think it's ok, do a live run, and let the script replace the links. After it's done delete it from the server - the entire /sr folder. Because if you leave it, someone could mess up your database.
After that, you can log in to your WordPress and all the content should be there exactly as you've left it on your localhost.
Hope this helps :)
You can use wp migrate db plugin to migrate you db for new server , after installation it require new server url and absolute path after that you and get original db to import .
I was following this guide: http://mrbool.com/how-to-create-a-login-page-with-php-and-mysql/28656 to create a login page. I followed everything to the letter but when I uploaded the two files (login.html and connectivity.php) to my public_html folder of my godaddy linux shared hosting server and attempted to test it out, I was met with a blank page when I navigated to: mydomainname.com/connectivity.php. Now after reviewing the code within connectivity.php, my suspicion was that my mistake lay somewhere in my database setup. This is what I am referring to:
I changed the database name "practice" to the actual name of my database that I created through godaddy. I got a little bit stuck on the "DB_USER" section though. I added a user to my database through godaddy's mysql application and changed the name "root" to the name I set for the user. Here is what I'm referring to:
After I did that I changed the "DB_Password" to whatever I had set for the username's password. I thought at this point I was done but when I attempted to navigate to the page, it still didn't work. I know the "DB_HOST" is set to localhost but I wasn't sure what I was supposed to change that to since phpMyAdmin panel stated the following: "Server:localhost" even though I'm using a server. I added all the tables and users to the mysql database correctly so I really think this has something to do with my configuration. If anyone could help me I would greatly appreciate it. Thanks.
I've been scouring the internet and attempting to troubleshoot this issue for hours and finally caved and decided to ask for help directly.
I'm running a linux dedicated server and need to load data into my mysql database by running a mysql query executed from a php page on the host machine.
The problem I'm having is I have no idea what the directory structure needs to look like in order to actually find my file and have it be uploaded. I'll give an example below.
LOAD DATA INFILE 'WHAT IN THE WORLD GOES HERE TO MAKE THIS WORK?'
INTO TABLE customers
The error that returns every time I try to run this is
Error Code: 1045. Access denied for user
I've already checked the permissions and the user has FULL permissions on the appropriate database. From my own research I have found that it can throw this error for a few reasons, one of which being that it cannot find the file I am trying to upload.
My file structure after you get into the public_html folder is as follows:
reports/uploads/fileName.csv
Thanks for any help in advance! This has been driving me insane. If I've just been doing this entirely the wrong way, or there is an easier way to accomplish what I am doing I'm also open to suggestions on that front.
As explained in the documentation:
If the file name is an absolute path name, the server uses it as given.
If the file name is a relative path name with one or more leading components, the server searches for the file relative to the server's data directory.
If a file name with no leading components is given, the server looks for the file in the database directory of the default database.
The public_html folder is irrelevant, since the file is being read by the MySQL server. If your webserver and database servers are different machines, and you're trying to load a file from the client, not the server, you need to use LOAD DATA LOCAL INFILE to specify that. Then the filename will be interpreted relative to the working directory of the client application.
Some thoughts: to use LOAD DATA INFILE on a file present on the server, the user performing the load data must have the FILE privileges. If the file is present client side, use LOAD DATA LOCAL INFILE.
This link is useful: http://dev.mysql.com/doc/refman/5.1/en/load-data.html
It's usually good to test the LOAD FILE with a file in an easily accessible location, such as /tmp to confirm that the privileges are okay. Then you can start to debug access issues to the location where your real file is located.
Hope this helps.
I have a php file I want to use for JSON purposes in the root directory of my ModX CMS.
I want to connect that file to the database, without exposing any critical information such as database username and password.
There is a config file that holds the info located in a folder that is in accessible from browsers but I do not know how to get that info back to my php file.
Can anyone help me either:
a) connect to the database securely straight from my php file
b) use variables stored in the already secure config file to connect
Any help would be greatly appreciated!
Thanks!
If you want to use all the features of modx in your extra file you probably want to load modx externally... http://rtfm.modx.com/display/revolution20/Loading+MODx+Externally
Basically I just added an include() going to the config file and it worked. Only issue was removing the ` marks which ModX adds to the database name. PLease let me know if anyone needs to clarify this more
I am a cakephp newbie and I tried to setup my connection to mysql. I had it worked before but after I changed my mysql database name, it won't connect anymore even thought I changed the database name in database.php inside the config folder. Do I have to run the cakephp console again??
Your tmp directory is writable.
The FileEngine is being used for caching. To change the config edit APP/config/core.php
Your database configuration file is present.
Cake is NOT able to connect to the databa
Above is the message shown.
Any ideas what I have to do? Thanks a lot!
Make sure that the new database allows the user in the database.php file to have access to the new database. Look at the MySQL GRANT syntax.