• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

securitywing

Menu
  • About
  • Must Read
      • IIS Performance Boost
      • RFID Security
      • Web App Security Testing
      • How to Secure Home Network
      • Prevent Cross-Site Scripting Attacks
      • Renew Self-Signed Certificates
      • Penetration Testing Tools
      • VPN Concentrator
      • Forensic Investigation Tools
      • Digital Certificates
      • Cloud Security Issues
      • Advanced Evasion Prevention
      • Firewall Types
      • Tips to Prevent Data Exfiltration
      • Classified Info Handling
      • MySQL Security
      • Definition of 7 Types of Malware
      • VOIP Security
      • Why Antivirus Software Fails
      • 15 Network Security Vulnerabilities
      • Web App Security
      • IT Security Standards
      • Types of Virtualization
      • Android Security
      • Digital Signature
      • Advanced Malware Protection
    • Close
  • Consultancy
  • Contact

How to Run MySQL Database Anonymize Script from Linux Bash Shell

by wing

How to run mysql annoymise scripot from bash shell.

To anonymize the production database for using in the test environment,  you can create a simple script that can run from the Linux Bash shell with a single command.

At first download a sample database:

# wget https://github.com/datacharmer/test_db/archive/master.zip

Next, unzip the file

#  unzip master.zip

If zip is not already installed in your Linux box, use either “yum -y run zip” in RedHat or centos or run “apt-get -y install zip” for Debian based Linux Distribution.

# cd test_db-master

mysql -u root -p -h mytestdb.ccowcjsacvpb.eu-west-1.rds.amazonaws.com < employees.sql

once the upload is  complete, you can create your anonymize script. The employees database  has the following tables:

For example, you want to anonymize the title column in the titles table and the name and gender columns in the

employees table. Create a file called script.sql and past the following lines:

 

UPDATE employees.titles SET title=’DevOps’;

UPDATE employees.employees SET first_name=’Super’, last_name=’man’, gender=’F’;

 

Now run the script from the shell:

mysql -u root -p -h mytestdb.ccowcjsacvpb.eu-west-1.rds.amazonaws.com  < script.sql

alternatively, you can run the script after logging into the MySQL shell:

mysql> source script.sql

Ref: https://oracle-base.com/articles/mysql/mysql-running-batch-scripts

Related Posts:

  • No Related Posts

Filed Under: Off Track

Primary Sidebar

CISSP Sample Test

Take a CISSP Sample Test

CISA IT governance Sample test



Twitter Follow @securitywing

Categories

  • AWS
  • containers
  • Internet Security and Safety
  • IS Audit
  • IT Security Exams
  • Network Security Tips
  • Off Track
  • Telecom
  • Tutorial

Pages

  • About
  • Best IT Security Certification Exam
  • CISA IT governance Sample test
  • CISA Sample Test
  • CISSP Sample Test Online
  • Consultancy
  • Contact

Popular Posts

  • 3 Steps to Install Miniku...
  • How to install a new Goda...
  • 63 Web Application Securi...
  • How to Setup AWS CloudFro...
  • How to Renew Self-Signed...
  • Host Based IDS vs Network...
  • 8 Effective Ways to Impro...
  • Active vs Passive FTP Mod...
  • Top 10 RFID Security Conc...
  • 3 Simple Steps to Capture...

Footer

Copyrights

Protected by Copyscape Duplicate Content Detection Software

Securitywing.com reserves the copyrights of all of its published articles.No contents of this site is permitted to be published to anywhere else in the Internet.If any contents are found in any other websites, securitywing reserves the rights to file a DMCA complaint. But you have the right to use the link of any relevant article of this site to point from your website if you consider that it might improve the quality of your article.

Tags

antivirus audit AWS backup browser check cisco cloud computer cyber data database encryption firewall home hsrp ids informaiton internet intrusion it kubernetes linux load balancing malware network protection putty risk router security security tips server ssh SSL switch tools virus vpn vulnerability web webserver website windows wordpress

Copyright © 2010-2023 ·All Rights Reserved · SecurityWing.com