How to change Mysql authentication method from auth_socket to mysql_native_password

In this article, we will see how we can change the MySQL root user default (Auth_Socket) authentication method to mysql_native_password.

Auth_socket Authentication

Auth_socket authentication is a server-side default authentication plugin that is used to authenticate the client input in order to access databases. Auth_Socket authentication plugin uses the SO_PEERCRED Unix socket option to obtain information about the user running the client program.

Mysql_native_password Authentication

The other authentication method is mysql_native_password authentication which is known as a traditional method to authenticate, it is not secure as Auth_socket authentication it uses just a hash of the password. This authentication method is not recommended for authentication.

The process to switch auth_socket to mysql_native_password:

First of all, check the current authentication method for this you can use the following command.

mysql> SELECT user, authentication_string,plugin,host FROM mysql.user;

To configure the root account to authenticate with a password, run the following ALTER USER command. Be sure to change the password to a strong password of your choosing

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';

Query OK, 0 rows affected (0.00 sec)

Now run the following command to flush the tables and implement new changes

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

Now you can see we have changed the authentication method from auth_socket to mysql_native_password

How to Install MySQL on CentOS 8 / RHEL 8 / Oracle Linux 8

In this quick guide, i will show you how to install MYSQL on CentOS 8 / RHEL 8 / Oracle Linux 8 instead of MariaDB.

MariaDB is the default implementation of MySQL in Red Hat Enterprise Linux 8 (RHEL 8) or CentOS 8.

MariaDB is a community-developed fork of the MySQL database project, and provides a replacement for MySQL.

However, in some cases, you still need to install MySQL as your deployment database on you Linux server.

Remove MariaDB installation :

If you server already have MariaDB database server installed, i would suggest you remove it first to avoid conflict.

[root@localhost ~]# sudo yum remove mariadb-server -y

2. Download MySQL 8.0 repo file :

[root@localhost ~]# wget https://dev.mysql.com/get/mysql80-community-release-el8-4.noarch.rpm

3. Install MySQL 8 repo file :

[root@localhost ~]# sudo rpm -ivh mysql80-community-release-el8-4.noarch.rpm

4. Install MySQL 8 database server :

[root@localhost ~]# sudo yum install mysql-server -y

Install MySQL on CentOS 8


5. How to Start MySQL server in linux :

[root@localhost ~]# sudo systemctl start mysqld

6. Enable auto start at boot :

[root@localhost ~]# sudo systemctl enable mysqld

7. At the initial start up of the MySQL database server, the following happens, given that the data directory of the server is empty:

a) The server is initialized.

b) An SSL certificate and key files are generated in the data directory.

c) The validate_password plugin is installed and enabled.

d) A superuser account ‘root’@’localhost is created. The initial root password created can be found in the error log file. You can get the password by issue the following command :

[root@localhost ~]# sudo grep 'temporary password' /var/log/mysqld.log

2016-06-19T23:08:09.439963Z 1 [Note] A temporary password is generated for root@localhost: sj-mMM;o%6Ll

8. Harden MySQL Server

Run the mysql_secure_installation script to address several security concerns in a default MySQL installation.

You will be given the choice to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options.

Install MySQL on CentOS 8 Result

Resource : http://dev.mysql.com/

Install MQTT Broker (Mosquitto) on centos 8

 In this article we will see how to Install MQTT Broker (Mosquitto) on centos 8.

We will be using the Eclipse-Mosquitto for MQTT configuration. 

Overview of Steps:

Install the Mosquitto

Configure The Mosquitto

Test the Server

Detailed Steps:

Step 1. Install the Mosquitto

[root@localhost ~]# sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y

[root@localhost ~]# sudo yum -y install mosquitto

[root@localhost ~]# sudo systemctl start mosquitto

[root@localhost ~]# sudo systemctl enable mosquitto

Step 2. Configure The Mosquitto with Auth, let's choose username/password auth.:

[root@localhost ~]# sudo mosquitto_passwd -c /etc/mosquitto/passwd username

then Choose the password

Step 3. Adding Port: Run the following command to allow port in firewall:

[root@localhost ~]# sudo firewall-cmd --permanent --zone=public --add-port=1883/tcp

[root@localhost ~]# sudo firewall-cmd --reload

Step 4. Test The Server

[root@localhost ~]# mosquitto_sub -t demo/one -h 127.0.0.1 -u username -P password -p 1883

[root@localhost ~]# mosquitto_pub -t demo/one -h 127.0.0.1 -u username -P password -p 1883 -m '{"message": 1}'



How to Build Your Own Discord Bots For Free in 5 Minutes

Think Discord is just a chat app? Think again! With these amazing tools and tutorials, you'll be able to build bots for your Discord server in 5 minutes! It doesn't matter if you've never coded before, now there's no excuse for not having a fully automated and customized Discord server.

# main.py

from flask import Flask

from threading import Thread

app = Flask('')

@app.route('/')

def home():

    return "Hello. I am alive!"

def run():

  app.run(host='0.0.0.0',port=8080)

def keep_alive():

    t = Thread(target=run)

    t.start()

Verify URL - https://discord.com/api/oauth2/authorize?client_id=[Client ID]&permissions=[Permission Integer]&scope=bot

# keep_ailve.py

import discord

import os

from keep_alive import keep_alive

client = discord.Client()

@client.event

async def on_ready():

    print('We have logged in as {0.user}'.format(client))

@client.event

async def on_message(message):

    if message.author == client.user:

        return

    if message.content.startswith('ping'):

        await message.channel.send('pong!')

client.run(os.getenv('TOKEN'))


 


How to Create MacOS Monterey Bootable USB on Mac

In this article we will see how to Create MacOS Monterey Bootable USB on Mac.

We will be using the mac command line terminal to create a bootable disk. 

This article has been created with the intention of helping MacOS Monterey Bootable USB users who are looking for a tutorial on how to create a MacOS Monterey Bootable USB on Mac.

Overview of Steps:

  • Download the Image file
  • Create Bootable Drive

Detailed Steps:

Step 1. Download the image file of MacOS Monterey using Safari Browser. 

https://apps.apple.com/us/app/macos-monterey/id1576738294?mt=12


Step 2. Insert the disk format the drive as shown in the below video.




Create Business Email Address for Free using Gmail + CloudFlare

In this article we will see how to Create Business Email Address for Free.

We will be using Gmail and CloudFlare. You don't need to spend money on your business email address anymore. All you need is a Gmail account and a Cloudflare account.

Requirements:

  • Domain Name
  • Gmail Account
  • CloudFlare(Free)

Overview of Steps:

Setup DNS for Domain

Setup Cloudflare for Email forwording

Configure Gmail Account

Detailed Steps:

Business Email Address for Free using Gmail + CloudFlare


The Nice Command and How to Use It

The nice command changes the priority of a process. A process with a lower priority will get less CPU time than a process with a higher priority.

The priority of a process can be a number between -20 and 19. A lower number means a higher priority. The default priority is 0.

Here is an example. This command will start the “sleep” command with a priority of 10:

$ nice -n 10 sleep 100

The “sleep” command will sleep for 100 seconds. While it is sleeping, other processes will get more CPU time than usual.

You can use the “top” command to see the priority of a process:

$ top

The “nice” command can be used to give a process a lower priority, so that it gets less CPU time.

The “renice” command can be used to change the priority of a running process.

The “nice” and “renice” commands can only be used by the root user, or by a user with the “CAP_SYS_NICE” capability.

Related commands

ionice – set or get process I/O scheduling class and priority

ps – report a snapshot of the current processes

renice – alter priority of running processes

top – display Linux tasks