I am new with Plesk, I used cPlanel whole this time, and never had problems like this.
I created database on subdomain and add user to that database, and when I enter in phpMyAdmin i get error "No Privileges". I cannot connect to database trough php because of this.
This is how it looks
http://imageshack.us/photo/my-images/9/unledpyzx.png/
priv http://imageshack.us/photo/my-images/9/unledpyzx.png/
Thank you in advance
Plesk doesn't give you permissions to create databases through the phpMyAdmin tool, and instead gives you a different interface for creating databases. It looks like you've already completed that step, so you should be fine. The next thing you need to do is define your db structure, which you can do using phpMyAdmin.
Related
I just installed an instance of Drupal on a shared web hosting account earlier today (via softaculous). I set some things different from how I wanted it the first time, so I deleted the directory it installed in, and the database and user that were created for it, and then tried again. Shortly after starting to work with the second install, I got the error described below, and I hadn't done much yet so I re-installed again. Now I'm on my third install, with all three using the same database and user name (I deleted the old MySQL database and user through cPanel before each install), and the same error is happening again.
When I try to access any of the drupal pages, I get this:
PDOException: SQLSTATE[HY000] [1045] Access denied for user
'mareofni_twocit'#'localhost' (using password: YES) in
lock_may_be_available() (line 167 of
home/mareofni/public_html/twocities/includes/lock.inc).
The "MySQL Databases" section of cPanel says that the database and user still exist. When I use the "check database" feature, it gives this error message:
Error from MySQL query: DBD::mysql::db do failed:
Unknown database 'mareofni_twocit'Failed to use
mareofni_twocit: Unknown database 'mareofni_twocit'
"Repair database" in cPanel doesn't fix the problem, and gives the same error message.
Error from MySQL query: DBD::mysql::db do failed:
Unknown database 'mareofni_twocit'Failed to use
mareofni_twocit: Unknown database 'mareofni_twocit'
I tried looking at the databse in phpMyAdmin, but phpMyAdmin doesn't list the database - like it can't tell that it exists.
Is there anything I can do to fix this problem myself, or prevent it happening again the next time I install Drupal? Some insight on what the problem is would also be helpful.
(Line breaks in the error messages are mine, added for readability.)
I've figured out that I cannot create database users who are able to drop databases, and the user I access phpMyAdmin through also cannot drop databases. Since phpMyAdmin couldn't find the database at all, I think the database must have been dropped or corrupted (rather than all the tables dropped or something).
This can't be something that Drupal did, since the Drupal user didn't have permission to drop the database. (Unless Drupal managed to corrupt the database somehow; I don't know enough about how that works to be sure of whether it's possible.) I suspect there's a bug in cPanel, Softaculous, or some other software put there by the hosting company that caused it. Maybe it didn't like that I re-created the DB immediately after deleting it.
I'm trying again with a different database name and crossing my fingers.
I have a database with two tables in it, and I have exported them into a "dump.sql" file in my computer.
I am using a free web hosting service (000webhost.com) and I have a database named "username_newdb" and I want the two tables to be imported in that database.
I tried "Import" from phpmyadmin page, but it gives the error access denied for user, I don't know why. Moreover, I prefer to import the tables into new database, not to import (and create) the whole database. Can I do this? Maybe with PHP code?
If not, creating a new database would be accepted, too.
Any help would be appreciated.
if you can connect to that database from your computer directly, you can use any mysql manager to do the import, assuming your login/password is right as backup sql is just text file with bunch of INSERTs and CREATE TABLEs (so basically phpmyadmin should not even complain).
Okay so heres the situation. I have just had to move servers due to budget cuts so the new server is a webfusion VPS. I am now getting an access denied error on all mysql queries. This is the specific error:
Access denied for user 'www-data'#'localhost' (using password: NO)
I do not know what is causing this. I have a database with the mysql username and password stored in a different php file. The username shown in the error is not the same as the actual ussername and I am using a password. It is my understanding that you can put your own php.ini file in the webfusions root and that will work. Is there something I have missed? I have been running on coffee today so that could be why. The mysql database is on the same server btw.
It could be a couple of things. I guess let's start with what is correct.
Your MySQL server address is correct and your webserver is able to connect to it. This should be a given since your webserver and MySQL server appear to be on the same machine.
The username you are using is www-data. That is the first thing I would check. Make sure that is the proper username.
Now check your password. It looks like you are trying to not have to use a password. Chances are that is incorrect (and if it is correct, you really should think about changing that).
Other than that, there is not much else that could be going wrong there. Are you intending to connect to the MySQL server that is on the same machine as your website?
Did you create the appropriate MySQL users after you migrated the database? Grant tables and user privileges are usually not transferred while doing a DB migration (unless you are using some specific tools like the ones provided by Percona etc.)
I have successfully setup a localhost (Individual Installs) with Apache 2.2, MySQL and PHP, as well as setup a couple virtual-hosts. Currently, I am trying to teach myself command line in MySQL. The part I am lost on is setting up the connection between the database that I create and the virtual-host website I am working on. In my mind I would want to save the database for a specific website in the same folder that I am creating the website. However, I could be way off base. Could some body explain how this piece of the puzzle and how it works. I tried to Google it and all I get is information regarding Work Bench and phpMyAdmin.
The MySQL server runs as a service (or daemon) on your server - so the folder (or directory) you put it in is set by the system configuration and has nothing to do with your document root for your web site.
In PHP, you will "connect" to the MySQL service using PDO or something similar and then send requests to the MySQL server using PHP commands.
When you are running the MySQL command line interpreter, you can also test those same commands by typing them yourself. This is helpful when you're debugging your PHP program so you can see the data that your program will get yourself in the command line interface.
I hope this helps put you in the right picture.
I tried to Google it and all I get is information regarding Work Bench and myPhpAdmin
this is the first entry on the first page when I google php mysql, it covers everything from installation up to code example.
Very generally:
You need to check with your hosting company if they offer you locally hosted MySQL server access. Using cpanel/phpMyAdmin, or whatever tools they have available for you, you can then login and create multiple databases as you please - each database maybe corresponding to one of your site folders. Once you have created your account and your databases, you can use php commands from your website code to connect to/manipulate whichever database you want.
EDIT: I missed where you said you already have a MySQL localhost setup. Now you need to login to your SQL server and create one or more databases and one or more user accounts for those databases. Create an admin account with all the privileges. Then you can use php in your webpage to connect to a database, using something like this:
$con = mysql_connect("localhost", "your_MySQL_username", "your_MySQL_password") or die ("Unable to connect to MySQL Server " . mysql_error());
if(is_resource($con))
$db = mysql_select_db($MySQL_database, $con) or die( "Unable to select database " . mysql_error());
See the manual for more ways to query the database and handle the results: http://php.net/manual/en/ref.mysql.php
had a bit of confusion going around in work earlier. Thought id run it by yous to see if anyone knows wats going on.
Were working on an internal administration system for our client, and its rite about to launch. Its comprised of TWO MySQL databases on the server [db_1 and db_2] and a PHP front end. [Both databases contain several tables].
There are maybe 90 different PHP files, some of which require a connection to our databases and ALL of these connections are made via a single PHP function which explicitly connects to the first database mentioned above [db_1] and supplies the login and password. And this works fine.
However, our second database, db_2, does not seem to require its own login and password to access its contents.
As soon as we connect to db_1, we seem to have full access to db_2, as long as we use the Full-Name for our tables [ie: db_2.usersTable] -> ("SELECT * FROM db_2.usersTable WHERE...").
And this is what was causing much confusion.
My question is this: Once you connect to a database on a server, do you have access to other databases on that server, or are we overlooking something???
Any feedback greatly appreciated lads...
You usually don't access a database server by a specific database, but by a user that has access to one or more databases.
for example:
mysql_connect("localhost", "user", "password") or die(mysql_error());
connects to the server and not a specific database.
Once connected to the database server you have access to all databases for which that user has permission. You just need to specify the database name in your queries if there are multiple databases that aren't the default.
mysql_select_db("myTable") or die(mysql_error());
sets myTable as the default, but you can still access other tables that the user has permission to.
I might be wrong, but doesn't PHP only connect and authenticate with the MySQL server with a user? And thus, based on that user's permissions, PHP can select any database that user has access to. I would check the permissions for the user you are connecting with...
Once you connect to a database on a
server, do you have access to other
databases on that server
If you have permissions to other databases, then yes. When you connect, you're connecting to the server and setting your default database to the one specified. Which is why you have to explicitly specify db_2 when you want to access it, but you don't have to specify db_1.