View the Selected MySQL Database on Linux via Command Line

Pre-Flight Check

  • These instructions are intended for viewing the selected MySQL database via the command line.
  • I’ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ll be logged in as root.

Continue reading “View the Selected MySQL Database on Linux via Command Line”

7 Extremely Useful Linux Commands for Beginners

#1: ls : What’s in this directory?

The command ls stands for list directory contents. And, cleverly, it will do just that: list a directory’s contents! Using it with -F will give a list of the directories contents, and denote items that are other directories with a trailing /.

ls -F

On my server returns:

allthethings.txt important.doc Indominus/ Misc/ probs.xls Red Wings/ Spreadsheets/ Work/

In the above case, allthethings.txt, garbage.file, important.doc, and probs.xls are files, and Indominus, Misc, Red Wings, Spreadsheets, and Work, each with the trailing /, are directories!

There are many other options, or switches, such as -F that can be used with ls for improved results. For example:

ls -lFa

Returns:

dr-xr-x---. 10 root root 4096 Apr 17 12:01 .
drwxr-xr-x. 19 root root 4096 Apr 14 12:45 ..
-rw-r--r-- 1 root root 0 Apr 17 12:00 allthethings.txt
-rw------- 1 root root 483 Apr 14 12:45 .bash_history
-rw-r--r--. 1 root root 18 Dec 28 2013 .bash_logout
-rw-r--r--. 1 root root 176 Dec 28 2013 .bash_profile
-rw-r--r--. 1 root root 361 Jan 1 01:24 .bashrc
drwxr-xr-x 3 root root 4096 Jan 1 01:25 .cache/
drwxr-xr-x 3 root root 4096 Jan 1 01:25 .config/
-rw-r--r--. 1 root root 100 Dec 28 2013 .cshrc
-rw-r--r-- 1 root root 0 Apr 17 12:01 garbage.file
-rw-r--r-- 1 root root 0 Apr 17 11:58 important.doc
drwxr-xr-x 2 root root 4096 Apr 17 11:59 Indominus/
drwxr-xr-x 2 root root 4096 Apr 17 11:57 Misc/
-rw------- 1 root root 42 Apr 14 12:44 .my.cnf
-rw-r--r-- 1 root root 0 Apr 17 12:00 probs.xls
drwxr-xr-x 2 root root 4096 Apr 17 11:57 Red Wings/
-rw------- 1 root root 1024 Jan 1 01:22 .rnd
drwxr-xr-x 2 root root 4096 Apr 17 11:56 Spreadsheets/
drw------- 2 root root 4096 Apr 14 12:42 .ssh/
-rw-r--r--. 1 root root 129 Dec 28 2013 .tcshrc
drwxr-xr-x 2 root root 4096 Apr 17 11:57 Work/

In the above case two switches are added: -l and -a. The -l uses the long listing format, and the -a switch lists all of the files, including hidden files.

Each column contains an important bit of information:

Column | Information | Example

  • 1 | Permissions | drwxr-xr-x
  • 2 | # of Hard Links | 2
  • 3 | User That Owns File or Directory | root
  • 4 | Group for File or Directory | root
  • 5 | File Size | 4096
  • 6 | Timestamp | Apr 17 11:59
  • 7 | Filename | Indominus/

Continue reading “7 Extremely Useful Linux Commands for Beginners”

How to Check the MySQL Version

Pre-Flight Check
  • These instructions are intended for checking the MySQL version on your server.
  • I’ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ll be logged in as root.

Here's 75% off a New VPS! Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support

From the Command Line

The following command:

mysql -V

Should return something similar to:

mysql Ver 15.1 Distrib 5.5.41-MariaDB, for Linux (x86_64) using readline 5.1

Note: Are you looking to upgrade MySQL on a Liquid Web Core Managed or Fully Managed server? Then contact our Heroic Support® team! And if you’re looking for ways to improve the performance of your VPS, check out our blog on Optimizing Your VPS!
From the MySQL Command Client

When you connect to MySQL using a command client with the following command, the version of the MySQL server is displayed:

mysql

You should receive a result similar to:

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 74
Server version: 10.1.20-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.MariaDB [(none)]>

The server version in this example is Server version: 10.1.20-MariaDB MariaDB Server.

Once connected to the MySQL Command client, you can also run the command:

SHOW VARIABLES LIKE "%version%";

Which should return a result similar to:

+-------------------------+---------------------------------+
| Variable_name           | Value                           |
+-------------------------+---------------------------------+
| innodb_version          | 5.6.34-79.1                     |
| protocol_version        | 10                              |
| slave_type_conversions  |                                 |
| version                 | 10.1.20-MariaDB                 |
| version_comment         | MariaDB Server                  |
| version_compile_machine | x86_64                          |
| version_compile_os      | Linux                           |
| version_malloc_library  | system jemalloc                 |
| version_ssl_library     | OpenSSL 1.0.1e-fips 11 Feb 2013 |
| wsrep_patch_version     | wsrep_25.16                     |
+-------------------------+---------------------------------+
10 rows in set (0.00 sec)

Looking for other MySQL tutorials? We have two awesome series! First, Basic Database Interaction. Second, Basic User Interaction. Check them out below!

 

 

How to Remove (Delete) a User on Ubuntu 14.04 LTS

Users via Command Line 101: Basic User Interaction
I. How to Add a User and Grant Root Privileges on Ubuntu 14.04 LTS
II. How to Remove (Delete) a User on Ubuntu 14.04 LTS

Pre-Flight Check

  • These instructions are intended specifically for removing a user on Ubuntu 14.04 LTS.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 14.04 LTS server, and I’ll be logged in as root.

Continue reading “How to Remove (Delete) a User on Ubuntu 14.04 LTS”

How to Remove (Delete) a User on Ubuntu 12.04 LTS

Users via Command Line 101: Basic User Interaction
I. How to Add a User and Grant Root Privileges on Ubuntu 12.04 LTS
II. How to Remove (Delete) a User on Ubuntu 12.04 LTS
Pre-Flight Check
  • These instructions are intended specifically for removing a user on Ubuntu 12.04 LTS.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 12.04 LTS server, and I’ll be logged in as root.

Continue reading “How to Remove (Delete) a User on Ubuntu 12.04 LTS”

How to Remove (Delete) a User on Fedora 21

Users via Command Line 101: Basic User Interaction
I. How to Add a User and Grant Root Privileges on Fedora 21
II. How to Remove (Delete) a User on Fedora 21
Pre-Flight Check
  • These instructions are intended specifically for removing a user on Fedora 21.
  • I’ll be working from a Liquid Web Self Managed Fedora 21 server, and I’ll be logged in as root.

Continue reading “How to Remove (Delete) a User on Fedora 21”

How to Remove (Delete) a User on Fedora 20

Users via Command Line 101: Basic User Interaction
I. How to Add a User and Grant Root Privileges on Fedora 20
II. How to Remove (Delete) a User on Fedora 20
Pre-Flight Check
  • These instructions are intended specifically for removing a user on Fedora 20.
  • I’ll be working from a Liquid Web Core Managed Fedora 20 server, and I’ll be logged in as root.

Continue reading “How to Remove (Delete) a User on Fedora 20”