Can't drop a database even though it has no content - php

I'm trying to clear out old databases on my PC (had them for past projects) and whenever I try and drop any of them, I get the following error:
#1010 - Error dropping database (can't rmdir '.\aroma_cafe', errno: 41)

It looks to me as if the system is attempting to delete a directory/folder that doesn't exist. Have you already removed it manually? It could be that each database is stored in a directory and a list of all databases in some other file.. so if you have gotten rid of that data, only the reference remains.

I think there are files within that directory that is not related to
MySQL. One scenario might be, insufficient permissions. You might want
to delete that directory from the filesystem.
Should do comment though.

Related

Can't find .sql file in sql query phpmyadmin (#13 Error)

I am trying to import a cities .sql file into my table.
I am using this github repository:
https://github.com/JoshSmith/worldwide-city-database
I have created the table, like it says in the repository,
but when it comes to importing the cities.sql I get an error.
LOAD DATA INFILE "/tmp/test_data/cities.sql"
INTO TABLE cities
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
(combined, population, country_code, region, latitude, longitude);
I also have a picture of it:
I mention that I am using a Mac, have read all the solutions and tried them out, but didn't work. I also made sure my file is in MAMP/tmp/.
EDIT: Sorry for the confusion from the image -> sql query. I have the file in /tmp/test_data/ . I have modified the query to look there.
You have the cities.sql? then you need to create new database ,give name:cities then import into cities your cities.sql file.
You indicated you had the file in MAMP/temp/ ...but the error indicates it's looking for the file in /tmp/test_data/. Check your tmp vs temp.
I suggest that you use the phpMyAdmin UploadDir feature instead. Due to various permissions issues, security means, and other idiosyncrasies those processes can be blocked from reading this file even though you provide the complete path. Using the phpMyAdmin UploadDir, you basically create a folder (mine is a subdirectory of my phpMyAdmin installation), add the directive to config.inc.php, and copy the file in there. phpMyAdmin shows it in a dropdown on the Import page. Again, you need proper permissions on the file and folder, but I find it easier than LOAD DATA INFILE.
If you prefer to continue to try the MySQL method, my guess is that it's a permissions problem. Make sure the webserver and MySQL processes have the proper permissions on the .sql file (and perhaps also on the directory it's in, though that probably shouldn't matter). Your webserver and MySQL error logs might have hints, also.

unable to select the wordpress database

Unable to select the wordpress database.
I am using WAMP server in windows 7 OS
while configuring the wordpress i am getting this kind of error
Thanks
It looks like you are not creating the database.You need to create database schema first manually. First Create database in Phpmyadmin. And give that name in your configuration file.
Make sure the database name you have given in wp-config.php is correct. Check if the database user name and password is correct. Also check if the user has the privilege to access the database.
Some times the problem appears when you have everything right there!!
So if you make sure you have created a database, giving the database name correctly while installing and you still are seeing the error, then:
1>> go to the root of your server
2>> Edit the file wp-config.php, set everything there manually, its that easy ;)
That should work for you!!

WordPress migrate sufficient permissions error

I have a strange problem, that I have never encountered.
I migrated web-site from my PC to the server. Well, I have done this a lot of times, but never encountered this issue.
Ok, what I did is, i copied the theme and exported the database and imported on the server + I replaced the table prefixes from wp_ to site_ to match the servers pre-made WordPress installation prefixes.
The page works fine, but, when I log in as an administrator ( there are no other users, then the admin ) I get this error:
And when I open the actual page I see this:
The white line one the top is where the admin menu should be.
It seems, that the user has actually logged in, but somehow is getting rejected from the server?
I know that this is a small isue that can be solved, by reinstalling WordPress with the exact settings that I have on my local PC, but I want to know why this happened and how to actually fix it.
PS: There are no addons involved in this. Just my custom theme.
It looks like you're being logged in, but your account doesn't have administrator privileges. Go to your site_usermeta table in the database and confirm that the meta_key and meta_value are using the correct prefix. They should be site_capabilities, site_user_level etc instead of wp_capabilities and wp_user_level etc. Also make sure that site_capabilities is set to administrator.
Additionally, check the site_options table to see if there are any option_names that are still using wp_ and not site_ Essentially, if you changed the prefix in the config file, you will need to change all entries of the prefix in your MySQL database as well.
Here's a good resource to follow: http://www.wpbeginner.com/wp-tutorials/how-to-change-the-wordpress-database-prefix-to-improve-security/

CakePHP undefinded index on table that exists

When i was posting my cakephp project online a view wasn't working for 100% anymore.
Local the view shows correct data but online it shows only on one of the 21 values
undefined index: commission_total [APP/View/Brokeraccountupdates/detail.ctp, line 77]
There where no typo's and the database field does exist.
i made a phpinfo on-line to compare the settings of php and mysql versions.
the code is identical and the server settings are good.
(paginator is good to).
can someone help me?
Ive had this issue before normally it is caused by the model being cached. Try deleting the model cache for your app:
cd <cake_app_root>
rm -rf app/tmp/cache/model/*
Or navigate to the directory in an FTP client and remove the files, however you manage your server
The hosting server has problems with permissions ect we use a new hosting server and the problem disappears.
thanks anyway.

Where do I hide my login info when using PHP connect to get to a database?

I need to connect to a mysql database using PHP. I am storing my login, user, password, and other info in a separate php file (let's say "mysql_connect.php") and then accessing it via require_once (mysql_connect.php) in a different file.
I have done a bit of googling and I know that I am supposed to keep "mysql_connect.php" out of the web root. I have moved it outside of the html folder and tried calling to it by using "../../mysql_connect.php" This is not working, it gives me an error "function not found" or something like that. Upon googling that, the internet says that its because it can't locate the file i'm referencing. When I move mysql_connect.php into a folder below root, everything works fine. The issue is because it is moved outside of the web root (i think).
I have been googling for two days now and cannot find a detailed explanation on how to get this to work. Something about changing the .htaccess file? I've read a bunch of articles on the theory but I am really looking for a step-by-step tutorial (I am a beginner). The only step-by-step tutorials I can find just tell you to put the config.php file into the same folder which is not secure.
Also in reading, it says that putting mysql_connect.php above root might not be THE most secure way to store the information as it is still basically just a .txt file and it can be retrieved easily(like downloading it). I am looking for a balance between secure and also do-able (for a beginner like myself). The mysql database I am trying to protect will not have any personal information and I plan on using a dedicated server (with no other information on it).
Can any one help me to solve this issue?
it gives me an error "function not found" or something like that.
This.
Is your main problem.
You either didn't bother to read this error message yourself nor didn't bring it here to help us to help you.
While
there is no problem in having this file below document_root,
and there is no problem in having this file above document root either,
the only problem you have is to assign a correct filename.
And the error message you got could help you more than 1000 volunteers from this site.
Despite of that, you can use PHP predefined variable to make this path work from whatever part of your site. Aassuming the file is one level above the document root, the code would be
require($_SERVER['DOCUMENT_ROOT']."/../mysql_connect.php");
however, this one may produce an error too, as nobody knows a real file locations. Thus, you may read the error message and corect the paths. Or post it here and get an interpretation
You can store the database information inside your web server configuration.
If you run Apache you can use SetEnv inside the VirtualHost. Since you're still on a shared host, your server admin probably need to help you with this. You can read more about this approach here.
... tried calling to it by using "../../mysql_connect.php" This is not working, it gives me an error "function not found" or something like that.
Include the connection details with:
require_once("../../mysql_connect.php");
This assumes that the file mysql_connect.php is two levels up from the currently executing script.
The database connection details will always be able to be read by whomever has administrative access to the server. It is not feasible to encrypt the file, because you would still need to store whatever key or password needed to decrypt it on the server as well, which would still not hide it from the server administrators.
Besides moving out of the web-root (which is a good step forward) an approach I've seen used is:
// at the top of your index or bootstrap file
define('SECURED', true);
And:
// at the top of any file subsequently included, such as mysql_connect.php
if(!defined('SECURED'))
{
exit();
}
This will at least prevent the file(s) from being accessed (executed) directly. This is helpful is the to-be-included files would otherwise issue a warning or error, that could potentially dump sensitive data as output.
If you're in a shared hosting environment you won't be allowed access outside of document root (most likely). You will need the password therefore it won't be completely secure. Instead, you can look into creating seperate mysql users with priviledges and limiting connections to to local accesses only.
i know i'm new, but something as simple as form for your login should be checked in order for it to work.
<form action="insertphpfilepath.php" method="POST">
and then in "insertphpfilepath.php", would have the mysql_query to check the login and password, not forgetting the mysql_query for connecting to the database and table using the right username and password .
a newbie recommendation to you for use mysql_real_escape_string for any $_POST['login'] so that it would become $login=mysql_real_escape_string($_POST['login']); for evading mysql injection.

Categories