Are you adding the user or just giving that user permissions in another DB? Those are two different things.
I have one site I am working on (1), and need to start on 3 new sites (2, 3 and 4).
I then place WordPress in each of these folders.
In htdocs I already have folder 1, and create folder 2, 3 and 4.
I then change the name of the “wp-config-sample.php” document for each of the new folders/sites, open it, change as follows;
define(‘DB_NAME’, ‘2’); (and 3 and 4)
define(‘DB_USER’, ‘Lars’);
define(‘DB_PASSWORD’, ‘MY-PASSWORD’);
and leave define(‘DB_HOST’, ‘localhost’); as is.
I then go in to PhPMyAdmin and create 3 new databases (1 is there already with DB_USER being “Lars” and DB_PASSWORD being “MY-PASSWORD)
When I try to establish user for site 2, I get the message “‘Lars’@’localhost’ already exist!” (translated from Danish to English).
So the question is, how can I use the same username and password for all 4 websites, as long as they are on my localhost (it will be changed when I upload to live server)?
I hope this explains the situation better!
You can. Don’t create a new user for DBs 2,3, and 4. Just give 'Lars'@'localhost' privs on those databases.
From the SQL tab:
GRANT ALL on DB2.* to 'lars'@'localhost'
GRANT ALL on DB3.* to 'lars'@'localhost'
GRANT ALL on DB4.* to 'lars'@'localhost'
Hmm – Steve Stern, luckily I took a backup of the database for my existing project, as I deleted them all to start over.
First I created the 4 new databases (byemery, energreen, flexsolution and hjertestarterekabe).
Then go press the SQL tab to enter – precicely:
GRANT ALL on byemery.* to ‘Lars’@’localhost’;
GRANT ALL on energreen.* to ‘Lars’@’localhost’;
GRANT ALL on flexsolution.* to ‘Lars’@’localhost’;
GRANT ALL on hjertestarterskabe.* to ‘Lars’@’localhost’;
(these are the actual titles of the 4 sites I am working on – not 1, 2, 3 and 4)
Once this is done, I close down the PHPMyAdmin page, open a new webpage and enter:
http://localhost/byemery
Here I expect to start setting up the WordPerfect installation – but run into a page which says “Error connecting to the database”!
Can you see what I do wrong?
You din’t set a password. The FIRST line should have been
GRANT ALL on byemery.* to ‘Lars’@’localhost’ IDENTIFIED BY ‘yourpassword’;
Hmmmmm – when I do that, I get the following error message:
Error
SQL query:
GRANT ALL on byemery.* to ‘Lars’@’localhost’ IDENTIFIED BY ‘mypassword’
MySQL said: Documentation
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘‘mypassword’’ at line 1
The password ‘mypassword’ is naturally replaced by my actual password, but I do not want to put that out here – you never know 😉
Any ideas?
-
This reply was modified 6 years, 6 months ago by
Lars.Lemming.
BTW Steve, thank you for your assistance, help and commitment – and that even on Thanksgiving, happy thanksgiving to you and your nearest
Did you put a semicolon at the end of the statement?
Yes, with the exception of the password, this is EXACTLY the statement I enter:
GRANT ALL on byemery.* to ‘Lars’@’localhost’ IDENTIFIED BY ‘MyPassword’;
GRANT ALL on energreen.* to ‘Lars’@’localhost’ IDENTIFIED BY ‘MyPassword’;
GRANT ALL on flexsolution.* to ‘Lars’@’localhost’ IDENTIFIED BY ‘MyPassword’;
GRANT ALL on hjertestarterskabe.* to ‘Lars’@’localhost’ IDENTIFIED BY ‘MyPassword’;
No. The only time you add “identified by” is when you either explicitly create the user or implicitly by giving privs *for the first time*. Once you’ve given a user a password, you don’t do it again.
Ahh – Got it, I have now created the user and password for the energreen site manually under the Privileges tab and then in the SQL tab added:
GRANT ALL on byemery.* to ‘Lars’@’localhost’;
GRANT ALL on flexsolution.* to ‘Lars’@’localhost’;
GRANT ALL on hjertestarterskabe.* to ‘Lars’@’localhost’;
and that seems to work – at least I have not gotten any errors!
Thank you ever so much Steve Stern for your help