Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 03/28/21 in Posts

  1. 1 point
    Working around in MySQL console for database ragnarok. This tutorial is mainly to support the release of pre-compiled Hercules for Win32 by me, OnNplay. Never-the-less it also closer to linux command line instead of using phpMyAdmin, HeidiSQL, Navicat, MySQL Workbench and other MySQL GUI client program. Hopefully, you will getting more confident to use PuTTY when you subscribe service such as VPS or dedicated server. Lets do our first mysql database "ragnarok" and also our first mysql user "ragnarok". To state the command I used quote character "command here;". Please ignore it when you type or select and copy. 1. Download, install WAMP Server and start it. On desktop taskbar near the clock, click WAMPSERVER - server Online > MySQL > MySQL console . 2. Now active MySQL console window is open asking you to "Enter password:". By default WAMP Server logging into MySQL console as "root" and no password. So just press Enter. Now you in the MySQL service enviroment. You should see "Welcome" followed by some texts ending with line "mysql>". 3. You need to change your user "root" password. Type "use mysql;" and you should see "Database changed". Command "UPDATE user SET password=PASSWORD('newpassword') WHERE user='root';". Type "update user set password=password('w4mps3rv3r') where user='root';" and press Enter. The "newpassword" is at your own wish. After pressing Enter, you should see "Query OK," followed by some texts ending with line "mysql>". 4. For the change to take effect on MySQL service, you need to type "flush privileges;" and press Enter. 5. Now you should test the new root's password. Type "quit;" and press Enter. MySQL console window will close. Do step no.1. Enter your new root's password and press Enter. After the line of "mysql>" appear, MySQL service enviroment is ready to execute mysql's commands. When you type a wrong or incomplete command, console will response with "->". What you need to do is just type ";" and press Enter. 6. Now you going to create a database to be used by Hercules emulator. By default Hercules will connecting to IP "127.0.0.1" port "3306" on database "ragnarok". Command "CREATE DATABASE database-name;". For deleting database, command "DROP DATABASE database-name;". Type "use mysql;" and press Enter. Next type "create database ragnarok;" and press Enter. Check the existence of your database, type "use mysql; show databases;" and press Enter. 7. Now you going to create one mysql user for Hercules to use. Do not let Hercules to use user "root". By default Hercules used mysql user "ragnarok" and it's password also "ragnarok". Command "CREATE USER 'user-name'@'host-name/IP' IDENTIFIED BY 'password';".For deleting user, command "DROP USER user-name;". Now type "create user 'ragnarok'@'localhost' identified by 'ragnarok';" and press Enter. Next you should do step no.4. To check the existence of user "ragnarok", type "use mysql; select user from mysql.user;" and press Enter. 8. You already create database "ragnarok" and user "ragnarok" in MySQL service. MySQL user can't simply access database without permission. Now you as a user "root" need to allow user "ragnarok" to access database "ragnarok". Command "GRANT ALL PRIVILEGES ON database-name.table-name TO 'user-name'@'host-name/IP';".For removing user to acces any database, command "REVOKE ALL PRIVILEGES ON *.* FROM 'user-name'@'host-name/IP';". Now type "grant all privileges on ragnarok.* to 'ragnarok'@'localhost';" and press Enter. Next you should do step no.4. 9. You should test the user "ragnarok". Type "quit;" and press Enter. MySQL console window will close. Now open folder where WAMP Server is installed and find where is file "mysql.exe" is located. During the making of this tutorial "mysql.exe" appear as "mysql" is located in "C:wampbinmysqlmysql5.6.12bin". Do not select any file inside the folder, if any one of the files is selected clear the select by clicking area after column "Size". Point arrow inside the folder, hold down the Shift key and at the same time do a right-click. Click "Open command window here". Type "mysql -uragnarok -p" and press Enter. You should see "Enter password:". Now type "ragnarok" and press Enter. 10. Here you going to prepare a text file for later use. Find and open folder "sql-files" which come with Hercules package. All the required files are with an extension ".sql" and can be read using Notepad++. Don't waste your time now to read it. Those files are containing default tables for database preparation. To get the full path of each file is by hold down the Shift key and do a right-click on the file, click "Copy as path". Next paste it in Notepad or Notepad++. Alternatively you also able to select all files and "Copy as path" too. The full path will come with quote character " " at beginning and ending. Delete it. Before file full path, add "source " with one space after it. Prepare file full path line by line so it easy for you to select and copy. Maybe you named the text file as "hercules-source-sql.txt". Before "C:UsersOnnplayDesktopHerculestrunksql-filesmob_skill_db.sql""C:UsersOnnplayDesktopHerculestrunksql-filesmob_skill_db_re.sql""C:UsersOnnplayDesktopHerculestrunksql-filesmob_skill_db2.sql""C:UsersOnnplayDesktopHerculestrunksql-filesitem_db.sql""C:UsersOnnplayDesktopHerculestrunksql-filesitem_db_re.sql""C:UsersOnnplayDesktopHerculestrunksql-filesitem_db2.sql""C:UsersOnnplayDesktopHerculestrunksql-filesitem_db2_re.sql""C:UsersOnnplayDesktopHerculestrunksql-fileslogs.sql""C:UsersOnnplayDesktopHerculestrunksql-filesmain.sql""C:UsersOnnplayDesktopHerculestrunksql-filesmob_db.sql""C:UsersOnnplayDesktopHerculestrunksql-filesmob_db_re.sql""C:UsersOnnplayDesktopHerculestrunksql-filesmob_db2.sql" After source C:UsersOnnplayDesktopHerculestrunksql-filesmob_skill_db.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesmob_skill_db_re.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesmob_skill_db2.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesitem_db.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesitem_db_re.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesitem_db2.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesitem_db2_re.sqlsource C:UsersOnnplayDesktopHerculestrunksql-fileslogs.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesmain.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesmob_db.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesmob_db_re.sqlsource C:UsersOnnplayDesktopHerculestrunksql-filesmob_db2.sql 11. Now you going to fill up database "ragnarok" with default tables. Back to step no.9 and file "hercules-source-sql.txt" opened for select and copy. Type "use ragnarok;" and press Enter. You should see "Database changed". Next inside the console, copy and paste "source C:UsersOnnplayDesktopHerculestrunksql-filesitem_db.sql" and press Enter. You should see many "Query OK," running till "mysql>" appear again. Repeat with other full path of your sql files. After filling up database "ragnarok", you may check how many tables are created. Type "show tables;" and press Enter. Total row is a total table in database. During the making of this tutorial, Hercules is at Revision 12214 supplied with 12 sql files producing total of 52 tables. 12. If you follow correctly this tutorial, Hercules emulator can run smoothly by now. Type "quit;" and press Enter to close the MySQL console.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.