Tag Info

Hot answers tagged

12

Linux does memory overcommit. That means it allows process to request more memory than really available on the system. When a program tries to malloc(), the kernel says "OK you got the memory", but don't reserve it. The memory will only be reserved when the process will write something in this space. To see the difference, you have 2 indicators: Virtual ...


10

There is nice tool called pv # On Ubuntu/Debian system $ sudo apt-get install pv # On Redhat/CentOS $ sudo yum install pv then e.g. you can use it like this $ zcat dbpackfile.sql.gz | pv -cN zcat | mysql -uuser -ppass dbname Please check UPDATE 2 for my latest version ps: check this blog http://blog.larsstrand.org/2011/12/tip-pipe-viewer.html ...


9

You're doing small random writes, which is pretty much the slowest thing you can do on a spinning disk, so I would say your throughput meets (my) expectations. Your avgrq-sz size is 15.35, which means your average request is 15.35 x the sector size of your SATA disk (most commonly 512 bytes, but possibly 4096 bytes on a very new SATA disk), so you're ...


9

The package mysql is the client package. You need to install the server package: $ sudo yum install mysql-server Additionally, starting in Fedora 19, MariaDB is now the default implementation of MySQL. MariaDB is a fork of MySQL. MariaDB, a community developed fork of MySQL, will be the default implementation of MySQL in Fedora 19. source: ...


8

Most shells send SIGHUP to the foreground process group on exit (and, in some, background processes as well, in bash this is controlled with the shell option huponexit), which might cause it to die, depending on how your mysql client handles that. You can run your command prepended with nohup to have it reparented by init if your shell exits, regardless of ...


7

There's no reason for you to write this script. /etc/init.d/mysql is an init(1) script, so just use that: # update-rc.d mysql defaults If that doesn't work, you might need to look into the more advanced update-rc.d options. For instance, maybe you are using an uncommon runlevel, and the default runlevels for the provided mysql script don't include that. ...


7

From the provided link to ENCRYPT() If no salt argument is given, a random value is used. salt is a 2 character string, saved in the beginning of the encrypted text. e.g. encrypting a string with salt='df', 'df' is in the start of the output product. mysql> SELECT ENCRYPT('hello','df'); +-----------------------+ | ENCRYPT('hello','df') | ...


7

You should do the following: apt-get purge mysql-server mysql-common mysql-client-<version> rm -rf /var/lib/mysql rm -rf /etc/mysql* Then you can reinstall in full.


7

Change the setuid bit of mysqld executable and the ownership of the executable file to mysql account, besides adding the required user in the group mysql for making him have access to the files on the filesystem. Use visudo -f /etc/sudoers and grant him permission to execute the /etc/rc.d/init.d/mysql start and /etc/rc.d/init.d/mysql stop as two seperate ...


7

Well, the trivial (perhaps cheating) way would be to run: mysql -NBe "select password('right')" This will produce a password using whatever password hashing scheme your version of mysql uses. [EDIT: added -NB, which gets rid of the column names and ascii table art.]


7

That is because mysql fully recreates .mysql_history file during its run. So when you run cat ~/.mysql_history after mysql execution, you're looking completely different file. Not the one tail is reading. You can easily check it with a simple test: $ ls -li .mysql_history 6685441 -rw------- 1 user user 1570 Sep 15 21:26 .mysql_history $ mysql i_test ...


6

Use wildcards: mysqlimport [options] db_name /path/to/sql/files/* If there are non-SQL files in that directory, the subset of files you do want to import may have some part of their file name in common. For instance, if they all end in .sql, the command becomes: mysqlimport [options] db_name /path/to/sql/files/*.sql If you come from DOS/Windows, it ...


6

1) Yes, that will dump the contents of all databases as a series of INSERT sql commands so you can restore the whole lot with mysql < backup.sql. Purely for wieldability's sake, I'd recommend you do this per database rather than using --all-databases as you get one honking big file containing EVERYTHING and it's not easily searchable. You may want to ...


6

You could suppress the tab column name by: ROW_CNT=$(mysql --raw --batch -e 'select count(*) from mydb.mydb' -s) echo $ROW_CNT Also, the semicolon at end your SQL command is unnecessary


6

The data on a tmpfs (Temporary Filesystem) will not persist across reboots. If you only care to preserve the mountpoint, that will be dictated by your /etc/fstab definition.


5

My two cent suggestion: you could use PAM to do this. E.g. Use some pam module as pam-mysql to store some of your users in mysql and pam_require to avoid that mysql-stored users can access other than sftp service. Start looking here: Modules/Applications available or in progress...


5

You can use the DEBIAN_FRONTEND environment variable. DEBIAN_FRONTEND=noninteractive aptitude -y install mysql-server > /dev/null 2>&1 or if you will run more than 1 install you might want to add an export to the top of your script export DEBIAN_FRONTEND=noninteractive aptitude -y install mysql-server > /dev/null 2>&1


5

On Ubuntu you should use service: sudo service mysql start And in the future if and when you want to restart it: sudo service mysql restart


5

Finding the transport Try using netstat -ln | grep 'mysql' and you can see how it is connected by the output. if you have access to shell On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to ...


5

The dot means there is an ACL (access control list) overriding the usual Unix permission scheme. Here's what mine looks like: $ ls -ld /tmp drwxrwxrwt. 7 root root 4096 Apr 23 22:36 /tmp $ getfacl /tmp getfacl: Removing leading '/' from absolute path names # file: tmp # owner: root # group: root # flags: --t user::rwx group::rwx other::rwx Check your ...


5

If it's installed as a service (most likely case), it should get the command to stop on the way down automatically. If it's not, then you should stop them first. Edit: Now that I have a few minutes at a computer, I'll expand on this a bit. One way to view your available services is to use the service command (typically /sbin/service) As root (or using ...


5

This actually has nothing to do with the shell, it's a 'feature' of the mysql command line utility. Basically when mysql detects that the output isn't going to a terminal, it enables output buffering. This improves performance. However the program apparently sends the success output to STDOUT, and the error output to STDERR (makes sense really), and keeps a ...


5

Any service running with a publicly-accessible port can be attacked and therefore be harmful to a server, and there have been some recent exploits against MySQL that can allow arbitrary code execution: http://www.securitytracker.com/id/1029708 http://www.securitytracker.com/id/1029184 There are also ways to cause MySQL to fill up all available disk space ...


5

If you look at these lines in your top output: Mem: 1016284k total, 1008232k used, 8052k free, 580k buffers Swap: 2096440k total, 2095168k used, 1272k free, 9872k cached you've run out of both RAM and swap. I suspect if you watch vmstat 10 output, you'll see the machine is dying from thrashing. A machine running MySQL and Apache ...


4

You need to run iostat several times while monitoring this to build up a true picture of what's going on. That, or use a tool like Cacti to keep such statistics for you over time so you can look at the historical graph. What's most likely happening is that the disk is also doing a lot of reads, due to the DB table scan, and the iostat run you posted just ...


4

I'm not using Fedora, but I believe it uses yum for package management. You can find and download necessary programs that you need from Fedora's repo. For example you want to install mysql, type yum install mysql in terminal as root. You can do a search first to check if the package is available in the repos with yum search kamailio.


4

Beginning with MySQL 5.1.26, the FEDERATED storage engine is not enabled by default in the running server; to enable FEDERATED, you must start the MySQL server binary using the --federated option. Or edit your /etc/my.cnf global server configuration file and under [mysqld] stanza section, add the line: federated The mysqld service has to be restarted to ...


4

To change options permanently and in the sanctioned manner, edit the files in /etc/sysconfig that have the same name as the service. For example, consider httpd. On one system I have, there are several things you can set: # Processing model HTTPD=/usr/sbin/httpd.worker # Additional options OPTIONS= # Set locale HTTPD_LANG=C (The actual file is much ...


4

The most efficient way to do this, would be piping from the mysqldump server. Sort of like this command list... ssh root@server1 'mysqldump --databases db | ssh root@server2 mysql' If you can't pipe from the remote machine, for some configuration related reason, you could do this command list... ssh root@server1 'mysqldump db' | ssh root@server2 'mysql ...


4

The mysql-server package is designed such that it will not touch user data on either remove or install. The issue you're seeing is probably that you have the i386 package installed and it wants the x86_64 package instead, or vice versa. You will need the full yum output in order to proceed.



Only top voted, non community-wiki answers of a minimum length are eligible