Tag: Internet & Technology

  • MySQL CLI Quick Reference

    Connecting to MySQL

    • Login to MySQL:
      mysql -u username -p

    Prompts for a password.

    • Specify Database on Login:
      mysql -u username -p -D database_name

    Basic Commands

    • Show all databases:
      SHOW DATABASES;
    • Select a database:
      USE database_name;
    • Show all tables in the current database:
      SHOW TABLES;
    • Describe the structure of a table:
      DESCRIBE table_name;
    • Show the current MySQL user:
      SELECT USER();
    • Show current database:
      SELECT DATABASE();
    • Show process list:
      SHOW PROCESSLIST;
    • Show full process list (to see full queries):
      SHOW FULL PROCESSLIST;
    • Exit MySQL:
      EXIT;

    CRUD Operations

    • Create a new database:
      CREATE DATABASE database_name;
    • Create a new table:
      CREATE TABLE table_name (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(100),
        age INT
      );
    • Insert data into a table:
      INSERT INTO table_name (name, age) VALUES ('John', 30);
    • Select data from a table:
      SELECT * FROM table_name;
    • Update data in a table:
      UPDATE table_name SET age = 31 WHERE name = 'John';
    • Delete data from a table:
      DELETE FROM table_name WHERE name = 'John';
    • Drop a table:
      DROP TABLE table_name;

    Loading .sql Files

    To load and execute an SQL file that contains queries or database structure (e.g., schema.sql or data.sql):

    Method 1: From Inside the MySQL Prompt
    1. Open MySQL:
       mysql -u username -p
    1. Select the database you want to load the file into:
       USE database_name;
    1. Load the SQL file:
       SOURCE /path/to/your/file.sql;
    Method 2: Directly from the Command Line

    You can execute the SQL file directly from the command line without entering the MySQL prompt:

    mysql -u username -p database_name < /path/to/your/file.sql

    This method runs the .sql file directly into the specified database.

    Common Tips

    • View running MySQL queries:
      Use SHOW FULL PROCESSLIST; to view running queries, especially helpful for debugging long-running queries.
    • Check MySQL version:
      SELECT VERSION();
    • Enable SQL logging:
      Use SET GLOBAL general_log = 'ON'; to start logging all queries. To view the log, check the path from the following:
      SHOW VARIABLES LIKE 'general_log_file';

    These commands and tips should help you navigate MySQL efficiently!

  • Credit Card Testing

    Credit Card Testing

    PayPal sandbox testing guide

    The PayPal sandbox is a self-contained, virtual testing environment that simulates the live PayPal production environment. The sandbox provides a shielded space where you can initiate and watch while your apps process PayPal API requests without touching any live PayPal accounts.

  • Omegle has shut down

    Omegle has shut down

    As the title states, Omegle has shut down.

  • Updated website to TT4

    Updated website to TT4

    I’m vibing on the updated default theme, Twenty Twenty-Four. Great job to the contributors!

    winding road photography
    Photo by Johannes Plenio on Pexels.com
  • Trex with feathers

    Trex with feathers

    I asked GPT-4 to generate an image of a tyrannosaurus rex with feathers like a chicken… it did not disappoint on the first image it created. Subsequent photos weren’t as impressive.

  • LAMP Stack Setup

    LAMP Stack Setup

    Setup for Ubuntu 20.04 LTS or 22.04 LTS. Lifted from this resource on AWS.

    Linux

    WSL, Ubuntu Multipass, or equivalant.

    Apache

    Version: distribution

    sudo apt update -y
    sudo apt install apache2 -y

    PHP FPM

    Version: 8.2

    Run the following commands to install PHP:

    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update -y
    sudo apt install php8.2 php8.2-{fpm,mysql,curl,gd,mbstring,mysql,xml,mcrypt,zip,ldap} libapache2-mod-php8.2 -y

    Install PHP-FPM

    sudo a2enmod proxy_fcgi setenvif
    sudo a2enconf php8.2-fpm
    sudo a2dismod php8.2
    sudo systemctl enable php8.2-fpm
    sudo service apache2 restart;sudo service php8.2-fpm restart

    MariaDB

    Version: 11.1.2

    Run the following command to add the MariaDB yum repository (For all Linux distributions):

    curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-11.1.2"

    Install MariaDB Package

    sudo apt install mariadb-server -y

    MariaDB Secure Installation

    sudo mysql_secure_installation

    When prompted, set a password for the root account:

    • Enter the current root password. By default, the root account doesn’t have a password set.
    • Press Enter.
    • Press N to switch to unix_socket authentication.
    • Press Y to set a password, and then enter a secure password twice. Make sure to store this password in a safe place.
    • Press Y to remove the anonymous user accounts.
    • Press Y to disable the remote root login.
    • Press Y to remove the test database.
    • Press Y to reload the privilege tables and save your changes.

    Permissions

    The following command will add the ubuntu user to the www-data group:

    sudo usermod -a -G www-data ubuntu

    The following commands will set the correct permissions for the /var/www directory:

    sudo chown -R ubuntu:www-data /var/www
    sudo chmod 2775 /var/www
    find /var/www -type d -exec sudo chmod 2775 {} \;
    find /var/www -type f -exec sudo chmod 0664 {} \;

    Your site is ready!

    Visit your website by entering your instance’s public IP address in your browser. You should see the default Apache page.

  • Common Git Commands

    Common Git Commands

    I have a variation of this posted on this site. Leaving this updated version here.

  • ActivityPub, Friends, and WP Code plugins

    ActivityPub, Friends, and WP Code plugins

    I’m trying out the ActivityPub and Friends WordPress plugins on this website. Also, using the WP Code plugin to add the following snippet of code, site wide.

  • RGVWEBPRO gets a facelift and a new purpose

    RGVWEBPRO gets a facelift and a new purpose

    Exciting times. RGVWEBPRO will return to the world of open source. It will no longer provide web hosting or sell domain names.

  • Introducing new GitHub Copilot features in VS Code!

    Introducing new GitHub Copilot features in VS Code!