Multi DB Plugin: Unclear installation instruction

There is a part of the multidb installation instructions that contains this:

“One final step is to make sure you have assigned a username and password to be associated with each database. This could be the same as your username and password for the original WordPress database. It’s up to you, just make sure that there IS a username and password associated with each one and note what it is. You’ll need this information for the next step.”

I am using 256 databases. Am I supposed to set the username and password for each one? How can I set one username and password somewhere and use it for all databases (which would be a really time saving option)?

  • Barry
    • DEV MAN’s Mascot

    I am using 256 databases. Am I supposed to set the username and password for each one? How can I set one username and password somewhere and use it for all databases (which would be a really time saving option)?

    You can either have a single one for all databases or one per database – the former is probably the best approach.

    Here is a guide to the command and syntax you need to use to add the users quickly to your mysql system:

    http://dev.mysql.com/doc/refman/5.1/en/create-user.html

  • drixie
    • Flash Drive

    Thank you for your prompt reply and the link.

    My MySQL skills are not really strong. After creating this user, how do I grant the user permissions across 256 databases within having to use GRANT manually for each database?

    Thank you for help

    P.S. Is it not possible for some code that makes this easy to be included in the first code that creates the MySql databases?

  • Barry
    • DEV MAN’s Mascot

    Have a read of this one:

    http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

    It has the code in it to grant all permissions to all databases.

    P.S. Is it not possible for some code that makes this easy to be included in the first code that creates the MySql databases?

    No, because without the access rights to the new databases we can’t run the code to grant access rights to the databases – so it’s sort of a vicious circle and therefore requires a little bit of manual work.

  • drixie
    • Flash Drive

    This is just a feedback/opinion:

    Since this step of the process is inevitable, I think some form of guide on how to go about it should be included in the installation instructions, or the MySQL links above should be provided in the guide. The statement below makes it look like its a walk in the park:

    One final step is to make sure you have assigned a username and password to be associated with each database. This could be the same as your username and password for the original WordPress database. It’s up to you, just make sure that there IS a username and password associated with each one and note what it is. You’ll need this information for the next step.

    It would be nice if readers (especially beginners) know that part WILL require some form of further research or outside help. Why? Because when something is a guide, or some form of installation manual, you tend to believe that everything you need is provided in the text, which will also let you know if you need to consult an extra resource to get something done.

    I spent one hour thinking I had done something wrong. The codes from the MySQL links are giving me some form of errors.. which means I cant do it properly. I have to contact my webhost to help me set up the permissions. I wish I knew that 2 hours ago.

  • Timothy
    • Chief Pigeon

    Hey drixie.

    Thanks for the feedback there, I’ll be sure to pass it on for you :slight_smile:

    We haven’t heard from you on this thread for a while. So I’m going to presume your all fixed up now and don’t need any further assistance. If do need anything else then just let us know. :slight_smile:

    Take care.

  • cartier247
    • Flash Drive

    Barry,

    My overall goal:

    Use WordPress Multisite to create 3,000,000 blogs from a CSV file using Batch Create and Multi-DB 4096 databases.

    Finished:

    • Created working version of WordPress multisite (path directory)

    Issue (stuck for two days): “Cannot get multi-db to work”

    1. Unzipped the multi-db pluggin and used FTP to upload to newly created mu-plugins folder under wp-content

    2. Ran SQL create databases script on my server

    3. Configured db-config file and used FTP to upload db-config and db file to wp-content folder

    4. Configured move-blogs file and uploaded to newly created scripts folder under wp-content folder

    5. Go to URL http://myinfopal.me/wp-content/scripts/move-blogs.php and get the following error “Could not connect to mysql”

    Best Regards,

    CJ

  • Barry
    • DEV MAN’s Mascot

    Unzipped the multi-db pluggin and used FTP to upload to newly created mu-plugins folder under wp-content

    Ok, this isn’t a step in the installation instructions, so you’ll need to delete everything you uploaded to the mu-plugins directory.

    Could not connect to mysql

    This suggests that the mysql connection settings are wrong in your move-blogs.php script, can you check the server, username and password are correct (these are usually the details you initially used when you set up WP) and that the user account has create permissions on all the databases you have created.

  • cartier247
    • Flash Drive

    Here are the original WP database permissions:

    I am using the admin username and passoword, but still get the error.

    What about the username wordpress_2?

    User Host Type Privileges Grant Action

    admin localhost global ALL PRIVILEGES Yes Edit Privileges

    wordpress_2 % database-specific ALL PRIVILEGES No Edit Privileges

  • cartier247
    • Flash Drive

    Ok, I see it now. I removed the dp.php file and the mu-pluggins content.

    Here are the permissions on one of the new (4096) databases created, I noticed there is no wordpress_2 username.

    User Host Type Privileges Grant Action

    admin localhost global ALL PRIVILEGES Yes Edit Privileges

  • Barry
    • DEV MAN’s Mascot

    Here are the permissions on one of the new (4096) databases created, I noticed there is no wordpress_2 username.

    Where did the wordpress_2 user come from?

    I assume you have set the same user that you have used in wp-config.php with permissions across all your other databases, so you just need to transfer those settings into your move-blogs.php script and it should connect.

  • cartier247
    • Flash Drive

    // ** MySQL settings – You can get this info from your web host ** //

    /** The name of the database for WordPress */

    define(‘DB_NAME’, ‘wordpress_2’:wink:;

    /** MySQL database username */

    define(‘DB_USER’, ‘wordpress_2’:wink:;

    /** MySQL database password */

    define(‘DB_PASSWORD’, ‘nBS6hc8V_5’:wink:;

    /** MySQL hostname */

    define(‘DB_HOST’, ‘localhost’:wink:;

    /** Database Charset to use in creating database tables. */

    define(‘DB_CHARSET’, ‘utf8’:wink:;

    /** The Database Collate type. Don’t change this if in doubt. */

    define(‘DB_COLLATE’, ”:wink:;

    define(‘WP_ALLOW_MULTISITE’, true);

  • Barry
    • DEV MAN’s Mascot

    Ok, so it seems like that user has been created to access the database of the same name.

    So, you have to decide if you want to use that user, then you will have to grant full permissions for that user to all your databases – otherwise you will have to use the admin user that you found before and use that for the user you want in your move-blogs and db-config files.

  • Barry
    • DEV MAN’s Mascot

    I changed the wp-config file from user wordpress_2 to admin, and got this error:

    Error establishing a database connection

    Which suggests that the user admin doesn’t have rights to the wordpress_2 database. So as I wrote earlier – you are going to have to choose which user you want to use and assign full rights to all the databases for that user before you can go any further.

  • cartier247
    • Flash Drive

    Note: I can logon to wp-admin interface for wordpress_2 using the admin ID with the wordpress_2 username configured in the wp-config file.

    All of the 4096 new databases and wordpress_2 have admin will full rights.

    User Host Type Privileges Grant Action

    admin localhost global ALL PRIVILEGES Yes Edit Privileges

    How do I make global changes to all 4096 databases if needed? (script)

  • Barry
    • DEV MAN’s Mascot

    Have you added permissions for all the databases for the user you are going to use?

    If so, then you add the details to move-blogs.php and run the transfer and it will create the tables in the relevant databases for you.

    You then need to set up your db-config.php with the database details you generated with the db-tools ( https://premium.wpmudev.org/db-tools/db_servers.php ) and the username, password you used in move-blogs.php

    There are more details on those steps in the installation notes here: https://premium.wpmudev.org/project/multi-db/installation/

  • cartier247
    • Flash Drive

    I just used phpmyadmin and granted user wordpress_2 rights to the global table now I can actually see something and not a blank screen when I go to the move-blogs.php URL.

    I used this SQL syntax:

    GRANT ALL PRIVILEGES ON wordpress_2_global.* TO ‘wordpress_2’@’localhost’

    IDENTIFIED BY ‘password_here’

    Now, is there some simple SQL syntax to grant permissions for all 4096 tables?

  • Barry
    • DEV MAN’s Mascot

    As I wrote in my previous reply – I don’t think you can grant it to all databases with phpmyadmin (in fact I’m pretty sure you can’t) – you need ssh or root access to mysql and then you can use the wildcard database names (as per the documentation link I linked to before for the grant command) to assign rights to all databases.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.