Currently Browsing: Databases

Install WEB server (LAMP) on Ubuntu with Firewall, Phpmyadmin and Firewall

Installing LAMP server Update source apt-get update Install Vim apt-get install vim Install tasksel apt-get install tasksel Install LAMP (with tasksel) type tasksel select LAMP and install Install phpmyadmin apt-get install phpmyadmin Install vsftpd apt-get install vsftpd Type vim /etc/vsftpd.conf Write into file chroot_local_user=YES service vsftpd restart Setting up firewall with iptables ————————————- Create firewall file vim /etc/firewall.sh Write firewall rules inside file #!/bin/sh IPT="/sbin/iptables" # Allow outgoing traffic and disallow any passthroughs $IPT -P INPUT DROP $IPT -P OUTPUT ACCEPT $IPT -P FORWARD DROP $IPT -A OUTPUT -j LOG $IPT -A INPUT -j LOG $IPT -A FORWARD -j LOG $IPT -F $IPT -X $IPT -t nat -F $IPT -t nat -X $IPT -t mangle -F $IPT -t mangle -X # Allow traffic already established to continue $IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # Allow ssh, dns, ldap, ftp and web services #$IPT -A INPUT -p tcp --dport ssh -i eth0 -j ACCEPT #$IPT -A INPUT -p tcp --dport domain -i eth0 -j ACCEPT #$IPT -A INPUT -p tcp --dport ldap -i eth0 -j ACCEPT #$IPT -A INPUT -p udp --dport ldap -i eth0 -j ACCEPT #$IPT -A INPUT -p tcp --dport ftp -i eth0 -j ACCEPT #$IPT -A INPUT -p udp --dport ftp -i eth0 -j ACCEPT #$IPT -A INPUT -p tcp --dport ftp-data -i eth0 -j ACCEPT #$IPT -A INPUT -p udp --dport ftp-data -i eth0 -j ACCEPT $IPT -A INPUT -p tcp --dport 80 -i eth0 -j ACCEPT $IPT -A INPUT -p tcp --dport 443 -i eth0 -j ACCEPT #$IPT -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT # Allow local loopback services $IPT -A INPUT -i lo -j ACCEPT # Allow all from and to Boomerang #WEB $IPT -A INPUT -j ACCEPT -p all -s 217.113.4.192/28 $IPT -A INPUT -j ACCEPT -p all -s 217.113.16.64/28 #Bionet $IPT -A INPUT -j...

[How To] Increase import file size in phpmyadmin

By default when you want to import sql file in phpmyadmin, in “File to Import:” section you can see (Max: 2MiB). That is php’s file upload limit. To increase it find php.ini file $ locate php.ini /etc/php5/apache2/php.ini /etc/php5/cli/php.ini /usr/share/doc/php5-common/examples/php.ini-development /usr/share/php5/php.ini-production /usr/share/php5/php.ini-production-dist /usr/share/php5/php.ini-production.cli /var/www/php.ini root@Gevorg-VM:/home/gevorgh# and edit $ vim /etc/php5/apache2/php.ini Find these variables and change to values you want: post_max_size = 8M upload_max_filesize = 2M max_execution_time = 30 max_input_time = 60 memory_limit = 8M Then restart apache to take effect $ service apache restart For this example I used Ubuntu...

[How To] Setup MySQL Listen on Localhost Only

If You want that MySQL listen only to localhost edit the MySQL configuration file and write bind-address=127.0.0.1 Configuration file can be /etc/my.cnf or /etc/mysql/my.cnf Next, you will need to restart the database server: $ sudo /etc/init.d/mysql...

How To Restore and Import MySQL Database

You should upload the dump file to the MySQL server, and type this command to import the databases into the MySQL server. mysql -u username –ppassword database_name < dump.sql Don’t put space after -p and then...

How to Online Backup Innodb Tables

Backup the database inevitable cause MySQL server unavailable to applications because when exporting, all tables acquired a global read lock using FLUSH TABLES WITH READ LOCK at the beginning of the dump until finish. So although READ statements can proceed, all INSERT, UPDATE and DELETE statements will have to queue due to locked tables, as if MySQL is down or stalled. If you’re using InnoDB, –single-transaction is the way to minimize this locking time duration to almost non-existent as if performing an online backup. It works by reading the binary log coordinates as soon as the lock has been acquired, and lock is then immediately released. mysqldump -u username –ppassword –all-databases –single-transaction > dump.sql Don’t put space after -p and then...

How to Export, Backup Or Dump A MySQL Database

To export a MySQL database into a dump file, simply type the following command syntax in the shell. mysqldump -u username –ppassword database_name > dump.sql Replace username, password, database_name and dump.sql as your needs. All data, tables, structures and database of database_name will be backed up into a mentioned file dump.sql. [alert]Don’t put space after -p and then...

How to Export A MySQL Database Structure

If You need to export only the MySQL database’s tables’ structures use –no-data switch. mysqldump -u username -ppassword –no-data database_name > dump.sql Don’t put space after -p and then...

How to Dump Several MySQL Databases Into Text File

Use –databases option for exporting several databases. mysqldump -u username -ppassword –databases db_name1 [db_name2 ...]...

« Older Entries