Creating a MySQL Database

Discussion in 'Systems Administration' started by Rlaxing, Jun 15, 2014.

Thread Status:
Not open for further replies.
  1. Can someone link me somewhere or tell me here step by step on how to setup a MySQL database for a plugin? I tried doing it with WAMPServer, but I keep on receiving an error when I try to turn it online.
     
  2. $mysql -u root -p
    >create database <name>;
    >exit
     
    • Agree Agree x 1
  3. ...... I have no idea what that means, i'm sorry.
     
  4. Could you give us some more information? Like, what operating system do you use?
     
  5. Windows 8.1 64 bit
     
  6. Ah, it's not quite the best running off of that however, using wamp server you can do the following:
    1. Click on the wamp button on your taskbar [​IMG] (Probably green for you)
    2. Click on mysql
    3. Click on MySQL console
    4. If you haven't changed anything, then simply click enter when entering your password.
    5. Write "create database <name>;" (Replacing the "<name>" with your a name for your database)

    Now, if your server is running on the same machine as the database, go to the config that requires a database and set the following values:
    database: <name>
    address (ip): 127.0.0.1 or localhost
    port: 3306
    username: root
    password: (your password, most likely nothing)

    There you go =)
     
  7. He needed the database for a plugin, also he's running his server off of a Windows 8 PC. So of what use would Mongo and Redis be?
     
  8. My bad, I read it as he was developing a plugin.
     
    • Friendly Friendly x 1
  9. It's not green for me, as I said, I get an error when I turn WAMP online, and my firewalls are off.
     
  10. Is it red? Because I've got an error as well, however my wamp still works, whenever I have to test something using MySQL.
    Also what's the error?
     
  11. Its orange. The error is in a pic below. Wouldnt let me copy and paste.

    EDIT: Yes get a good laugh at my second tab open :p I was looking for the songs that play in the back of fifa 14 :D
     

    Attached Files:

    • Informative Informative x 1
  12. No problem =) Next time I suggest googling it rather than creating a thread. It only took me about 10 seconds to find that fix xD
     
  13. oops :p
     
  14. A side-note,
    I'm sorry but if you're gonna use Windows 8.1 to run a server you should consider hosting. Windows 8.1/8/7 are most definitely not equipped to handle the stresses that a server must undergo. As a server owner myself, I recommend either getting separate hardware to run Windows Server 2008-12 if you wish, or Linux.

    You are putting your hardware on the edge of it's performance by using a PC to run a server.

    PM me with Qs.
     
  15. #1 - You must create a database.
    #2 - You must create a login account.
    #3 - You must grant permissions for that login account to that database.
    #4 - You update your plugin configuration to specify the MySQL database server name/ip, the database name, user ID and user password.
    #5 - Most plugins will create the tables and populate the data as long as you have done the prior steps.

    How you do all of these depends on the tools you use. If you have access to the server command prompt where the database is installed, you can run the mysql command-line. If you access the database using PhpMyAdmin, then you can run queries inside that. If you are running MySQL on a Windows machine and you have WorkBench installed, you can use that utility. I'm sure there are several other ways as well and depending on how you connect will decide the exact steps you take.

    Creating the database and user accounts are the super easy parts that are extremely easy to find via google.

    The step to grant permission can require a bit more knowledge of how your server is setup and can determine if you pass or fail in your connection attempt. For example, if your MySQL database is run on the same server as your minecraft server, then you can grant access for the user ID to the database as "local only" access. If your database is on a different server, you can grant access for the user ID to that database for "that server name" only...meaning the user ID is only allowed to connect from your specified minecraft server machine/IP. Another option is to grant access for that user ID to the database as "global" access meaning that ID can connect to the database from anywhere in the world...which is typically not as secure but can be handy if your machine name changes or you have multiple servers that connect to the same database and you use the same ID.

    Here are some examples of SQL syntax for setting up a database called "minecraft" with an ID of "minecraftuser" and password of "mypass123" but I STRONGLY suggest you never use this exact ID/pass combo now that the entire world knows about it.

    Example #1 - Database and Minecraft on same machine
    Code (Text):

    CREATE DATABASE minecraft;
    CREATE USER 'minecraftuser'@'localhost' IDENTIFIED BY 'mypass123';
    GRANT ALL PRIVILEGES ON minecraft TO 'minecraftuser'@'localhost';
    FLUSH PRIVILEGES;
     
    Example #2 - Minecraft on separate machine called srv-minecraft
    Code (Text):

    CREATE DATABASE minecraft;
    CREATE USER 'minecraftuser'@'srv-minecraft' IDENTIFIED BY 'mypass123';
    GRANT ALL PRIVILEGES ON minecraft TO 'minecraftuser'@'srv-minecraft';
    FLUSH PRIVILEGES;
     
    Example #3 - User ID able to login to database from anywhere
    Code (Text):

    CREATE DATABASE minecraft;
    CREATE USER 'minecraftuser'@'%' IDENTIFIED BY 'mypass123';
    GRANT ALL PRIVILEGES ON minecraft TO 'minecraftuser'@'%';
    FLUSH PRIVILEGES;
     
    HammondsLegacy
     
    • Informative Informative x 1
  16. jflory7

    jflory7 Retired Moderator
    Retired Benefactor

    Thread moved => Systems Administration
     
    • Optimistic Optimistic x 1
  17. I never said I was running my server on windows 8?
     
  18. https://bukkit.org/threads/bukkit-guide-mysql.50500/
     
Thread Status:
Not open for further replies.