MariaDB – Admin – MySQL Query commands

Information about mysqladmin (administrative program for mysqld daemon)
XREF to: https://mariadb.com/kb/en/mariadb/mysqladmin/

Q: Where do you run mysql commands from?
A: From within the mysql monitor
Note: mysql -u root -p (Note: The password is what I set for the database system)
Note: I don’t think this is same as mysqladmin

Q: What are all commands from Help?
A: The following:
List of all MySQL commands:
Note that all text commands must be first on line and end with ‘;’
? (\?) Synonym for `help’.
clear (\c) Clear the current input statement.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit (\e) Edit command with $EDITOR.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
help (\h) Display this help.
nopager (\n) Disable pager, print to stdout.
notee (\t) Don’t write into outfile.
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print (\p) Print current command.
prompt (\R) Change your mysql prompt.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute an SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
system (\!) Execute a system shell command.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don’t show warnings after every statement.

Q: How to show all databases?
A: show databases;
information_schema |
| mysql |
| performance_schema |
| test

Posted in Linux | Leave a comment

MariaDB – Admin – managing and confirming service is running

Desired Outcome:
Understanding the components that go into running the MariaDB Server – service, confirming status, starting, stopping, scripts, etc. Based on various documentation I’ve referred to, it’s important to now understand the end-to-end flow of database service startup.

Q: What is the MariaDB server binary called?
A: mysqld
Note: The “d” stands for daemon, and is written “mysqld” to preserve upstream compatibility with MySQL

Q: Is MariaDB a binary drop-in replacement for SQL?
A: Yes

Q: How to check if mysqld is running? (Option 1)
A: sudo service mysqld status
Redirecting to /bin/systemctl status mysqld.service
mariadb.service – MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
ââmigrated-from-my.cnf-settings.conf
Active: active (running) since Wed 2015-11-25 10:34:27 PST; 4 days ago
Main PID: 1291 (mysqld)
Status: “Taking your SQL requests now…”
CGroup: /system.slice/mariadb.service
ââ1291 /usr/sbin/mysqld
Nov 25 10:34:26 localhost.localdomain mysqld[1291]: 2015-11-25 10:34:26 13972…
Nov 25 10:34:27 localhost.localdomain mysqld[1291]: Version: ‘10.1.8-MariaDB’…
Nov 25 10:34:27 localhost.localdomain systemd[1]: Started MariaDB database se…
Hint: Some lines were ellipsized, use -l to show in full.

Q: How to check if mysqld is running? (Option 2)
A: systemctl status mysqld.service
mariadb.service – MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
ââmigrated-from-my.cnf-settings.conf
Active: active (running) since Wed 2015-11-25 10:34:27 PST; 6 days ago
Main PID: 1291 (mysqld)
Status: “Taking your SQL requests now…”
CGroup: /system.slice/mariadb.service
ââ1291 /usr/sbin/mysqld

Q: How to check if MariaDB.service is running?
A: systemctl is-active mariadb.service
Note: Will respond “active” if it is running

Q: How do you manually start the SQL Server?
A: sudo systemctl start mariadb.service

Q: How do you manually stop the SQL Server?
A: sudo systemctl stop mariadb.service

Q: How do you launch the SQL Monitor?
A: mysql -u root -p

Q: How do startup scripts work (current configuration) to auto-load MariaDB upon server statup?
A: Script is within: /etc/init.d/mysql
Note: XREF to this for more documentation — https://mariadb.com/kb/en/mariadb/mysqlserver/
Note: When I had installed, it automatically created the script within /etc/init.d and called it mysql

Posted in Linux | Leave a comment

Project Summary (Centos7, JDK7, Apache Tomcat, MariaDB)

Project Summary:

As of 20151126, I have the following components installed on my test server. I originally went down path of installing Apache Tomcat (because of the association with LongJump CRM), thinking that I would also be able to install PHP and SugarCRM. Now I realize that Apache Tomcat is more for Java-based apps and Apache HTTPD would be for HTML Site, PHP, phpMyAdmin, SugarCRM. It’s possible to install HTTPD on my current test server, but I’m going to hold off for now.

I have enough to go on for now with current system, for learning stuff, and could work to join the MariaDB (SQL) Server to the Apache Tomcat WebServer. Initial focus would then be on MariaDB and Java apps.

Itemized list of of what I currently have installed as of 20151126:

Centos7 (CentOS Linux release 7.0.1406 (Core))
Command: cat /etc/centos-release

CentOS Kernel Version (Linux localhost.localdomain 3.10.0-123.9.3.el7.x86_64 #1 SMP Thu Nov 6 15:06:03 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux)
Command: uname -a

MariaDB version installed:
Command: yum list installed mariadb*
Installed Packages
MariaDB-client.x86_64 10.1.8-1.el7.centos @mariadb
MariaDB-common.x86_64 10.1.8-1.el7.centos @mariadb
MariaDB-server.x86_64 10.1.8-1.el7.centos @mariadb
MariaDB-shared.x86_64 10.1.8-1.el7.centos @mariadb

MariaDB running? (Yes – Active)
Command: systemctl is-active mariadb.service

MariaDB – how to run it
Command: mysql -u root -p
Note: Password is what I set for the Database Server

Java JDK 7 (java version “1.7.0_91”)
Command: java -version

Apache Tomcat (Version: 8.0.28)
Note: cd /opt/tomcat
Command: java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/8.0.28
Server built: Oct 7 2015 18:25:21 UTC
Server number: 8.0.28.0
OS Name: Linux
OS Version: 3.10.0-123.9.3.el7.x86_64
Architecture: amd64
JVM Version: 1.7.0_91-mockbuild_2015_10_21_20_22-b00
JVM Vendor: Oracle Corporation

Project Learning Focus:

-Linux – using CentOS
-SQL Databases – using MariaDB
-Web Server (Java focused) – using Apache Tomcat
-Java Programming
-Programming Languages (Python, C++)

Posted in Linux | Leave a comment