http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.External.Repl.html
Labels
amazon
apache
apt
aptitude
automate docker image
awk
aws
awstat
backup
bandwidth
bash
binary log
bond
bridge
caching
centos
centos 7
cluster
concurrency
csv
digitalocean
disk
django
docker
docker images
dovecot
drop cache
enviroment
error
explain
free
fstab
ftp
git
gluster
go
gpg
grep
grub
header
header check
icinga2
imapsync
information
innodb
ip
iproute
isolation
ispconfig
java
jenkins
jump
kdump
keepalived
kvm
linux
locale
logbuffer
lookbehind
macos
mail
maillog
matplotlib
mcrypt
memory
modrewrite
monitoring
mount
msyql ndbcluster
mta
multipath
mutt
my.cnf
mysql
mysql error
mysql optimization
mysql permission
mysqlcluster
mysqldump
nethogs
network
nginx
node
nopasswd
ntp
nxlog
openssl
optimization
parsing
parted
password
pflogsumm
php
php-fpm
php5-mcrypt
phpmyadmin
pip
policyd
post
postfix
proxy
pycurl
python
query_cache
querydict
rdesktop
rds
recommender systems
recover mysql
redhat
redolog
regex
regularexpression
resilver
roundcube
route
rsync
scrapy
script
scrub
security
service
setfacl
sftp
slow
smtp
snnp
spamassassin
spotlight
sql
squirrelmail
ssc
ssh
ssh-copy-id
ssl
startup
syslog
syslog over tls
tar
telnet
tls
tomcat
transaction
troubleshoot
tuning
ubuntu
udev
ulimit
usb
vdev removal
virtualhost
virtualization
virtualmin
vrrp
watch
webscrape
wget
x11
zfs
zfs send
zfs recv
zpool
mysql error #1005 - Can't create table (errno: 150) importing database from another server
http://stackoverflow.com/questions/9018584/error-code-1005-cant-create-table-errno-150/30102503#30102503
Reference link to stackoverflow
Reference link to stackoverflow
This could also happen when exporting your database from one server
to another and the tables are listed in alphabetical order by default.
So, your first table could have a foreign key of another table that is yet to be created. In such cases, disable foreign_key_checks and create the database.
Just add the following to your script:
vim export.sql
use databasename100;
..
...sql'sss ....
and it shall work.
So, your first table could have a foreign key of another table that is yet to be created. In such cases, disable foreign_key_checks and create the database.
Just add the following to your script:
vim export.sql
use databasename100;
SET FOREIGN_KEY_CHECKS=0;
....
...sql'sss ....
and it shall work.
linux, web, ispconfig3, python, bash, apache
mysql error
reset user password using GRUB and set grub password in the end Ubuntu 14.04 LTS
on boot menu
select "e" to edit the menu item
find line starting with "linux..." and in the end append init=/bin/bash
and press
ctrl+x
mount -o remount,rw /
passwd <username>
reboot -f
To set grub password
login as root
vim /etc/grub.d/40_custom
select "e" to edit the menu item
find line starting with "linux..." and in the end append init=/bin/bash
and press
ctrl+x
mount -o remount,rw /
passwd <username>
reboot -f
To set grub password
login as root
# grub2-mkpasswd-pbkdf2
OR
grub-mkpasswd-pbkdf2
Password: ****
Reenter password: ****
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A
Paste the encrypted long string into the file /etc/grub.d/40_custom
eg. copy the content starting from "grub.pbkdf2.sha512.10000.9CA461100..."vim /etc/grub.d/40_custom
set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
grub2-mkconfig -o /boot/grub2/grub.cfgor grub-mkconfig -o /boot/grub2/grub.cfg
if on the local terminal use help of "tee"grub-mkpasswd-pbkdf2 | tee myhelper.txt
your password content and other text are copied in myhelper.txt, edit this myhelper.txt file and cat its content to /etc/grub.d/40_custom
cat myhelper.txt >> /etc/grub.d/40_custom
grub-mkconfig -o /boot/grub2/grub.cfg
apache xss protection headers
Setting up Apache to emit NoSniff, X-Frame and X-XSS-Protection headers
Security Headers is a service which checks that your web server is not revealing too much information. It does this by checking the HTTP headers returned with every request. The service checks to see if the server information is being leaked or if it’s reporting what scripting language is being used in the X-Powered-By header.The service also checks and reports on a list of useful security headers like NoSniff, which prevents browsers from MIME-sniffing a response away from the declared content-type. It also checks for headers which prevent clickjacking and cross site scripting by detecting if X-Frame-Options and X-XSS-Protection are defined.
Add the headers to the Apache config file
I decided it would useful to implement these headers on the web servers I support. In particular I wanted to prevent other sites from framing my content within an iframe. By setting the X-Frame-Options to deny I am explicitly disallowing framing of any type. After a little research, these are the headers that my servers now emit:<IfModule mod_headers.c> Header unset ETag Header set X-Frame-Options: deny Header set X-XSS-Protection: "1; mode=block" Header set X-Content-Type-Options: nosniff Header set X-WebKit-CSP: "default-src 'self'" Header set X-Permitted-Cross-Domain-Policies: "master-only" </IfModule>If your using the Joomla CMS, then using deny on the X-XSS-Protection will prevent the media manager from working properly. In this case you will need to relax the setting to use the same origin policy:
Header set X-Frame-Options: sameorigin
ssh error
root@server1:~# service ssh restart
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
[....] Restarting OpenBSD Secure Shell server: sshdCould not load host key: /etc/ssh/ssh_host_ecdsa_key
The root cause of this problem is that sshd daemon somehow is not able to load SSH host keys.
When OpenSSH server is first installed on Linux system, SSH host keys should automatically be generated for subsequent use. If, however, key generation was not finished successfully, that can cause SSH login problems like this.
Let's check if SSH host keys are found where they should be.
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
[....] Restarting OpenBSD Secure Shell server: sshdCould not load host key: /etc/ssh/ssh_host_ecdsa_key
The root cause of this problem is that sshd daemon somehow is not able to load SSH host keys.
When OpenSSH server is first installed on Linux system, SSH host keys should automatically be generated for subsequent use. If, however, key generation was not finished successfully, that can cause SSH login problems like this.
Let's check if SSH host keys are found where they should be.
$ ls -al /etc/ssh/ssh*key
make sure size is not zero,
good example:-
root@server1:~# ls -al /etc/ssh/ssh*key
-rw------- 1 root root 668 Nov 30 18:12 /etc/ssh/ssh_host_dsa_key
-rw------- 1 root root 227 Dec 5 15:03 /etc/ssh/ssh_host_ecdsa_key
-rw------- 1 root root 1675 Nov 30 18:12 /etc/ssh/ssh_host_key
-rw------- 1 root root 1671 Nov 30 18:12 /etc/ssh/ssh_host_rsa_key
-rw------- 1 root root 668 Nov 30 18:12 /etc/ssh/ssh_host_dsa_key
-rw------- 1 root root 227 Dec 5 15:03 /etc/ssh/ssh_host_ecdsa_key
-rw------- 1 root root 1675 Nov 30 18:12 /etc/ssh/ssh_host_key
-rw------- 1 root root 1671 Nov 30 18:12 /etc/ssh/ssh_host_rsa_key
[SOLUTION - debian / ubuntu ]
root@server1:~# dpkg-reconfigure openssh-server
Creating SSH2 ECDSA key; this may take some time ...
[ ok ] Restarting OpenBSD Secure Shell server: sshd.
Creating SSH2 ECDSA key; this may take some time ...
[ ok ] Restarting OpenBSD Secure Shell server: sshd.
[SOLUTION - redhat/centos]
On CentOS, RHEL or Fedora, all you have to do is to restart sshd after removing existing (problematic) keys.
$ sudo systemctl restart sshd
An alternative way to regenerate SSH host keys is to manually generate them using ssh-keygen command.
$ sudo rm -r /etc/ssh/ssh*key
$ sudo systemctl restart sshd
An alternative way to regenerate SSH host keys is to manually generate them using ssh-keygen command.
$ sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
$ sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
$ sudo ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
$ sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
$ sudo ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
Once new SSH host keys are generated, make sure that they are found in /etc/ssh directory. There is no need to restart sshd at this point.
$ ls -al /etc/ssh/ssh*key
Now try to SSH again to the SSH server to see if the problem is gone.ispconfig 3 phpmyadmin 404 not found error
ln -s /usr/share/phpmyadmin /var/www/
service nginx restart
mysupermarket.com/phpmyadmin
enter user/password and login...this will redirecto below url
http://mysupermarket.com/index.php?token=81d1f26028dc0f0f625803c2d1ccd402
it will still give
ERROR 404 - Not Found!
The following error occurred:
The requested URL was not found on this server.
Please check the URL or contact the webmaster.
insert phpmyadmin between domain.com and index.php.... like below
http://mysupermarket.com/phpmyadmin/index.php?token=81d1f26028dc0f0f03c2d1ccd402#PMAURL:server=1&target=main.php&token=81d1f26028dc0f0f625803c2d1ccd402
still need to fix....
linux, web, ispconfig3, python, bash, apache
ispconfig,
nginx,
phpmyadmin
ispconfig 3 squirrelmail "Could not move/copy file. File not attached" when trying to attach a file"
1) create directory in /usr/share/squirrelmail/ for example attach - /usr/share/squirrelmail/attach
mkdir -p /usr/share/squirrelmail/attach
2) chmod 733 -R /usr/share/squirrelmail/attach
2) squirrelmail-configure
3) choose 4(General Options) and press Enter
4) choose 2(Attachment Directory) and paste ==> /usr/share/squirrelmail/attach
press 'S' to save and exit
done !!
linux, web, ispconfig3, python, bash, apache
ispconfig,
squirrelmail
ispconfig 3 move spam to junk folder
http://www.geekonthepc.com/2012/01/23/configuring-anti-spam-spamassassin-in-ispconfig-3/
ISPConfig relies on SpamAssassin – which is, when configured correctly, a very powerful spam filter. But for some reason, it just wasn’t working on my installation of ISPConfig. Spam would get through and it can get seriously frustrating!
Thankfully I now have it cracked – and wanted to share the configuration I chose for ISPConfig and SpamAssassin. I think the correct settings vary from person to person – but if you want general spam filtering, this should show you how to get it.
Instructions
First of all, make sure a ‘spamfilter’ policy is active both for the email domain you’re using and for each email mailbox. I chose the Uncensored policy in my case – but different rules apply to each setting. I found Uncensored to be most effective, but simply choosing this won’t make it work properly.
Once you’re happy that it’s supposedly on, you need to modify the rules for the policy you chose. Head to the ‘Email’ tab, and then from the left menu select ‘Policy’ under the ‘Spamfilter’ section (see screenshot that follows).
ISPConfig relies on SpamAssassin – which is, when configured correctly, a very powerful spam filter. But for some reason, it just wasn’t working on my installation of ISPConfig. Spam would get through and it can get seriously frustrating!
Thankfully I now have it cracked – and wanted to share the configuration I chose for ISPConfig and SpamAssassin. I think the correct settings vary from person to person – but if you want general spam filtering, this should show you how to get it.
Instructions
First of all, make sure a ‘spamfilter’ policy is active both for the email domain you’re using and for each email mailbox. I chose the Uncensored policy in my case – but different rules apply to each setting. I found Uncensored to be most effective, but simply choosing this won’t make it work properly.
Once you’re happy that it’s supposedly on, you need to modify the rules for the policy you chose. Head to the ‘Email’ tab, and then from the left menu select ‘Policy’ under the ‘Spamfilter’ section (see screenshot that follows).
Select the policy you’re working with by
simply clicking on it. Then select the ‘Tag-Level’ tab. This is where
you set how sensitive SpamAssassin actually is. I found that the first
three settings needed to be set as the following:
SPAM tag level: 3
SPAM tag2 level: 3.4
SPAM kill level: 5
SPAM tag2 level: 3.4
SPAM kill level: 5
The other settings requiring a number can
be left alone. However, to make SPAM easier to separate, I’d suggest you
turn on ‘SPAM modifies subject’ and choose a tag you’d like to add to
SPAM emails. Here’s what the page might look like when you’re done (see
screenshot that follows).
Hit ‘Save’ and it’s a good’en. If you also
want to move SPAM email to a seperate Junk folder, you can do so by
going to the ‘Email Mailbox’ page from the left menu, then selecting
your email account and clicking the ‘Mail Filter’ tab. Simply tick the
‘Move Spam Emails to Junk directory’ checkbox and dodgy email will be
moved.
Hopefully that should get you going and stop infuriating SPAM emails reaching your inbox.
linux, web, ispconfig3, python, bash, apache
ispconfig,
spamassassin
Table ‘./mysql/user’ is marked as crashed and should be repaired
How to make mysql service online from crash!
mysqld started
[ERROR] /usr/sbin/mysqld: Table ‘./mysql/user’ is marked as crashed and should be repaired
[ERROR] Fatal error: Can’t open and lock privilege tables: Table ‘./mysql/user’ is marked as crashed and should be repaired mysqld ended
Which means DB: /var/lib/mysql/mysql table: “user” has been crashed.
To resolve this issue, please perform the commands below:
]# service mysql start --skip-grant-tables
now with mysql started, you can repair the mysql/user table
]# mysqlcheck -r mysql user
After that,
]# service mysql stop
]# service mysql start
OR
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> check table user;
+————+——-+———-+———————————————————-+
| Table | Op | Msg_type | Msg_text |
+————+——-+———-+———————————————————-+
| mysql.user | check | warning | Table is marked as crashed |
| mysql.user | check | warning | 6 clients are using or haven’t closed the table properly |
| mysql.user | check | error | Record at pos: 24992 is not remove-marked |
| mysql.user | check | error | record delete-link-chain corrupted |
| mysql.user | check | error | Corrupt |
+————+——-+———-+———————————————————-+
5 rows in set (0.02 sec)
mysql> repair table user;
+————+——–+———-+——————————————+
| Table | Op | Msg_type | Msg_text |
+————+——–+———-+——————————————+
| mysql.user | repair | warning | Number of rows changed from 1384 to 1385 |
| mysql.user | repair | status | OK |
+————+——–+———-+——————————————+
2 rows in set (0.48 sec)
mysql> check table user;
+————+——-+———-+———-+
| Table | Op | Msg_type | Msg_text |
+————+——-+———-+———-+
| mysql.user | check | status | OK |
+————+——-+———-+———-+
1 row in set (0.02 sec)
mysql>
#service mysql start
linux, web, ispconfig3, python, bash, apache
mysql,
mysql error
ssh port forward
Understanding SSH Port Forwarding
29 April 2015
Port forwarding (tunneling), especially the local port forwarding, is a very handy feature of SSH. This blog explains local port forwarding in detail first. After that, this blog then introduces remote port forwarding and dynamic port forwarding briefly.
How local port forwarding works
Before getting started, let us assume we have the following three hosts and want to forward all traffics to port 80 of my pc to the port 8080 of target host.
This is a case which SSH local port forwarding applies. The command to set the tunnel is:
ssh ssh_server -L 80:target:8080
This command set up a SSH connection between my PC and the SSH server. This connection, in addition to working as usual, also acts a tunnel.
When traffics arrive at port 80 of my pc, they will then go through the tunnel.
Jump three hops
Note that in fact a traffic can be originated from a forth machine. That is, you can "jump 3 hops" with a single SSH tunnel.
According to man page, the listening port will, by default, be bond to the loop back interface only. To forward traffics from other machines, one must
- Set
GatewayPortsin/etc/ssh/sshd_configto "yes". - Specify bind address. For instance (empty or * for any), on ssh client run the following command:
ssh -L :80:ssh_server:8080 target
But according to my test,
- GatewayPorts does not take effect.
- Remote port forward bind to all interface by default.
Option '-N'
Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).
Remote Port Forwarding
As the name indicates, remote port forwarding is the reverse of local port forwarding. This time, the traffic arrives at the "remote" side will be forwarded to the host on local side.
ssh ssh_server -R :8888:target:8080 ssh ssh_server -R :8888:localhost:8080
Dynamic Port Forwarding
Yet another kind of port forwarding turns your local machine to a socket proxy. For instance, assume that your local machine locates behind firewall and all outgoing HTTP requests are filtered by the firewall. A way to circumvent this restriction is to set up an ssh server outside the firewall and employ the dynamic port forwarding technique.
- Run the following command to set up ssh tunnel.
ssh ssh_server -D 8000
- Then, in web browser, set proxy as "SOCKS Host"
localhost:8000.
Exercise: study the following picture and compare dynamic port forwarding with local port forwarding.
Subscribe to:
Posts (Atom)

