Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HASHCASE DATABASE SETUP FOR LINUX
- 1. Install mysql-server
- > sudo apt install mysql-server
- > mysql --version
- 2. Install mysql workbench
- VIA .deb
- - Install all packages from https://dev.mysql.com/downloads/workbench/
- > sudo dpkg -i path_to_deb_file
- VIA SNAP
- > sudo apt install snapd
- > sudo snap insall mysql-workbench
- 3. Configure mysql
- >sudo systemctl start mysql.service
- >sudo mysql_secure_installation
- ```bash
- Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
- Success.
- Normally, root should only be allowed to connect from
- 'localhost'. This ensures that someone cannot guess at
- the root password from the network.
- Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
- ... skipping.
- By default, MySQL comes with a database named 'test' that
- anyone can access. This is also intended only for testing,
- and should be removed before moving into a production
- environment.
- Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n
- ... skipping.
- Reloading the privilege tables will ensure that all changes
- made so far will take effect immediately.
- Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
- Success.
- All done!
- ```
- 4. Create Databases
- > sudo mysql -u root -p
- ```sql
- mysql> create database hashcase_db_dev;
- mysql> create database hashcase_db_test;
- ```
- 5. Set password (for user=root password=password) and configure mysql without sudo
- > sudo mysql -u root -p
- ```sql
- mysql> show databases;
- mysql> use mysql
- mysql> select user, host, plugin from mysql.user;
- mysql> update user set plugin="mysql_native_password" where User="root";
- mysql> flush privileges;
- mysql> exit;
- ```
- > mysql -u root
- ```sql
- mysql> SET GLOBAL validate_password.policy=LOW;
- mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
- mysql> exit
- ```
- > sudo service mysql restart
- 6. Workbench setup
- - create a new connection with name hashcase_db_dev
- - port is 3306 and hostname is localhost or 127.0.0.1
- - username is root
- - password is password
- - run the mysql server
- - make a connection with from the workbench
- 7. Dumping into the database
- - Obtain the file hashcase_db.sql
- > sudo mysql -u root -p hashcase_db_dev < hashcase_db.sql
- > sudo mysql -u root -p hashcase_db_test < hashcase_db.sql
- Final Notes:
- - If you get following error while running database migrations, execute the following code depending on error
- 1. ERROR: Duplicate column name 'loyalty'
- ```sql
- mysql> insert into SequelizeMeta (name) values ("20240518160400-add-loyalty-to-user.js");
- ```
- 2. ERROR: Duplicate key name 'unique_code'
- ```sql
- mysql> insert into SequelizeMeta (name) values ("20240518160502-create-loyalty-table.js");
- ```
- 3. ERROR: Duplicate column name 'fuel_wallet_address'
- ```sql
- mysql> insert into SequelizeMeta (name) values ("20240604205346-add-fuel-wallet-address-to-users.js");
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement