Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Essential Linux Administration Commands for Database and Web Services

Tech Jul 14 2

MySQL Command Line Error Recovery

When executing multi-line statements in the MySQL command-line interface, an error in a preceding line can be frustrating. Use the \c command to cancel the current input and return to the "mysql->" prompt.

Tomcat Service Management

Navigate to the Tomcat bin directory first: cd /usr/local/tomcat/bin

  • Start service: ./startup.sh
  • Stop service: ./shutdown.sh

Verifying Tomcat Shutdown

Check for remaining Java processes: ps -ef|grep java

root      7010     1  0 Apr19 ?        00:30:30 [java] <defunct>

The presence of a defunct process indicates successful shutdown.

Real-time Tomcat Log Monitoring

  1. Navigate to logs directory: cd tomcat/logs
  2. Monitor output: tail -f catalina.out
  3. Exit with Ctrl+c

Resolving Tomcat Memory Issues

For OutOfMemoryError exceptions, modify /bin/catalina.sh by adding these JVM options before the "Using CATALINA_BASE" echo statement:

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1024m -Xmx1024m -XX:NewSize=512m -XX:MaxNewSize=256m -XX:PermSize=512m -XX:MaxPermSize=512m"

Vim Editor Essentials

Editing files: vi /usr/local/mytxt

  • Enter insert mode with i
  • Exit insert mode with Esc
  • Save and quit: :wq followed by Enter

Linux Firewall Management

Persistent settings (survive reboot):

  • Enable: chkconfig iptables on
  • Disable: chkconfig iptables off

Immediate settings (reset on reboot):

  • Enable: service iptables start
  • Disable: service iptables stop
  • Check status: service iptables status

Individual Port Configuration

  1. Open port: /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
  2. Save configuration: /etc/rc.d/init.d/iptables save
  3. Restart service: /etc/init.d/iptables restart
  4. Verify opening: /sbin/iptables -L -n

SELinux Management

Check status: /usr/sbin/sestatus -v or getenforce

Temporary disable: setenforce 0

Permanent disable: Edit /etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled, then reboot.

MySQL Administration Commands

Connection: mysql -hlocalhost -uroot -p -P3306

Password modification:

mysql -uroot -p
mysql> use mysql;
mysql> update user set authentication_string=password('newpass') where user='root';
mysql> flush privileges;
mysql> exit;

Basic operations:

  • show databases;
  • use database_name;
  • show tables;
  • quit;
  • create database new_db;

MySQL Case Sensitivity Configuration

Add to /etc/my.cnf under [mysqld] section:

lower_case_table_names=1

Values: 0 = case-sensitive, 1 = case-insensitive. Restart MySQL after change.

MySQL Character Encoding

Check encoding: show variables like 'character%';

Configure UTF-8 in /etc/my.cnf:

[client]
default_character_set=utf8

[mysqld]
collation_server = utf8_general_ci
character_set_server = utf8

MySQL Status Monitoring

Display runtime information: STATUS;

MySQL Backup Procedures

For automated backup strategies, see separate documentation on Linux MySQL backup automation.

Tags: LinuxMySQL

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.