Saturday, February 29, 2020

MySQL - Create user, Database and access remote(CentOS 7)

When you need to create a new user on mysql you need to login with user root, for that you need to login from console use the next command.

mysql -u user -p your_password


Create user.


*Localhost

CREATE USER 'your_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON *.* TO 'your_user'@'localhost' WITH GRANT OPTION;

*RemoteAccess 

CREATE USER 'your_user'@'your_ip' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON *.* TO 'your_user'@'your_ip' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Note: if the access is denied still when you run command line above then you need the configuration file /etc/my.cnf and add next line on the file bind-address:your_ip. and then you need tu restart mysql.

#mysql
systemctl restart mysql 

#mariadb
systemctl restart mariadb.service

Next: open the required port 3306, run the next command.

iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT

In the end: Save the iptables configuration

service iptables save

Create Databases.


CREATE DATABASE your_database;


GRANT ALL PRIVILEGES ON your_database.* TO 'your_user'@'localhost';








References:
https://linuxize.com/post/how-to-create-mysql-user-accounts-and-grant-privileges/
https://www.inmotionhosting.com/support/website/how-to-create-a-database-using-mysql-from-the-command-line/
https://www.hostinger.com/tutorials/mysql/how-to-grant-remote-access-mysql-vps
https://support.infrasightlabs.com/article/host-is-not-allowed-to-connect-to-this-mysql-server/
https://serverfault.com/questions/626922/no-mysqld-or-mysql-server-after-mariadb-server-install


Monday, February 17, 2020

Installing Java 8 on CentOS 7


Installing Java 8 on CentosOS 7.

Steps:

Step 1: Update

yum -y update

Step 2: Install Java 8


yum install java-1.8.0-openjdk


Step 3:  Verify Java is Installed

java -version


Step 4: Java alternatives (choose Java 1.8..)



update-alternatives --config java

update-alternatives --config javac

update-alternatives --config javaws


Step 5: Environment

vim .bash_profile

Inside on file, copy path your jdk, example:

export JAVA_HOME=/usr/lib/jvm/YOUR_JDK/jre/bin/java


Refresh the File:
Source .bash_profile

echo $JAVA_HOME























Multiple Data Sources in Spring Boot 3 with Java 21

  In this blog post, we'll explore the configuration and setup for a Spring Boot 3 application with Java 21 that uses multiple data sour...