1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

MySQL

Discussion in 'Plugin Help' started by Gabriel Gomez, Aug 7, 2017.

  1. Gabriel Gomez

    Gabriel Gomez Spider Jockey

    Messages:
    32
    GitHub:
    ggomez
    I am having a bit of trouble figuring out how to use MySQL in the plugins on my server (Such as PurePerms, MyPlot, SimpleAuth, etc...). How do I setup the database? How do I link MySQL to the plugins? If somebody could explain to me how that all works or refer me to a tutorial that can I would greatly appreciate it!
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    What OS?
     
  3. Gabriel Gomez

    Gabriel Gomez Spider Jockey

    Messages:
    32
    GitHub:
    ggomez
    My server is run off of a Linux VPS with Debian 8
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Steps are quite obvious:
    1. Install MySQL server (google that)
    2. Connect to MySQL server and create a schema (google that) with any name you like, or even one schema per plugin
    3. If the machine hosting MySQL server is not the same machine hosting the PocketMine server, use the `mysql` command to make sure you can connect to it from the PocketMine server's machine. (google how to use `mysql`)
    4. Stop the server. Look at the plugin's config file and type the credentials (usually host, username, password and "database"/"schema"; and port (default 3306)). Make sure to "quote your values". Start the server again. Done.
     
    HimbeersaftLP likes this.
  5. Gabriel Gomez

    Gabriel Gomez Spider Jockey

    Messages:
    32
    GitHub:
    ggomez
    I have successfully linked mysql to PurePerms. How do I edit the groups.yml and such? Do I have to do it all through commands or is there a way to upload my groups.yml file?
     
  6. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    You may edit them using the client from the `mysql` command. MySQL is a partially-simple partially-complicated language -- this or this may be a good place to start with. (You can see what tables and columns are available using the SHOW TABLES and DESCRIBE queries)
    I don't think PurePerms provides official tools for automatic porting of YML to MySQL. @Awzaw Any plans?
     
    Last edited: Aug 7, 2017
  7. Gabriel Gomez

    Gabriel Gomez Spider Jockey

    Messages:
    32
    GitHub:
    ggomez
    One more question. For simpleauth, if you login once and it is all connected through MySQL do they have to log in again when they connect to another server linked with MySQL. (You have a spawn and from the spawn you can go to different servers like a Minigames Server and a Survival Server but you do not want to have to login each time you go through these servers)
     
  8. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    And he may also use Phpmyadmin (or similar) if he prefers an UI :D
     
  9. Gabriel Gomez

    Gabriel Gomez Spider Jockey

    Messages:
    32
    GitHub:
    ggomez
    How do I do that?
     
  10. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    I already linked you some resources. You may use the INSERT INTO / UPDATE / DELETE FROM queries to modify data and use the SELECT query to view data. Use SHOW TABLES / DESCRIBE to look at the structure of your data.
    You may want to know understand what MySQL is -- it is a table-based database. This means that all data are saved in tables, which is largely different from YAML.
    As @HimbeersaftLP has mentioned, if you can't understand MySQL queries, install phpmyadmin and use the UI -- but note that the installation of phpmyadmin might be even more compliclated.
     
    HimbeersaftLP likes this.
  11. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    I'm HimbeersaftLP, and I approve this message...
     
    Gabriel Gomez likes this.
  12. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    The best way to edit groups.yml is to stop the server and edit manually in a text editor, checking the yaml in a tool such as codebeautify.org/yamlvalidator before you save and start the server. PurePerms should adjust players ranks automatically if, for example, you delete a rank from groups.yml.

    As for importing yaml to mysql, I'm sure @SOFe could have done that in the time it took him to write that post :)
     
    SOFe likes this.
  13. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Meanwhile all the bureaucracy :D
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.