Buscar este blog

Cargando...

viernes, 20 de abril de 2012

How to stop a running mysql query

login in mysql

[root@sol ~]#mysql -u username -p

SHOW PROCESSLIST;
KILL <thread_to_be_killed>;


Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  SHOW PROCESSLIST;
+----+--------+---------------------+--------+---------+------+-----------+------------------------------------------------------------------------------------------------------+
| Id | User   | Host                | db     | Command | Time | State     | Info                                                                                                 |
+----+--------+---------------------+--------+---------+------+-----------+------------------------------------------------------------------------------------------------------+
|  2 | bacula | 192.168.2.229:55920 | NULL   | Sleep   |   50 |           | NULL                                                                                                 |
|  3 | bacula | localhost           | bacula | Query   |  463 | executing | SELECT Path.Path, Filename.Name, Temp.FileIndex, Temp.JobId, LStat, MD5 FROM ( SELECT FileId, Job.Jo |
|  4 | root   | localhost           | NULL   | Query   |    0 | NULL      | SHOW PROCESSLIST                                                                                     |
+----+--------+---------------------+--------+---------+------+-----------+------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

mysql>
kill 3;


lunes, 2 de abril de 2012

Change Default User Login Shell Permanently

To change the default linux shell type every time a new user is created, simply modify linux file /etc/default/useradd. 

Edit /etc/default/useradd, the default linux shell is explicitly defined. You can change that to suit your needs.

[root@MyLinuxServer ~]# vi  /etc/default/useradd

# useradd defaults file
GROUP=100
HOME=/var/www/html                                                        "Change default folder user"
INACTIVE=-1
EXPIRE=
SHELL=/sbin/nologin                                                            "Not login ssh"
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

lunes, 26 de marzo de 2012

How to duplicate a MySQL database

Let's say the original database is dbSouce and the duplicate is dbDestinatio.
- Login in MySql, Create a new database, dbDestination
- Set permissions new database.
- Run this command in console, for duplicate database

[root@LinuxServer ~]# mysqldump -u root -pMyPassword dbSouce | mysql -u root -pMyPassword dbDestination



 


Notice: There is no space between -p and the password.