MySQL cannot be started due to insufficient disk space during binary installation of MySQL5.5.39 _ MySQL
Source: Internet
Author: User
-- Add users and groups [root @ zlmlocal] groupadd [root @ zlmlocal] useradd-gmysql-ssbinnologin-doptmsyqlmysql -- create a directory [root @ zlmlocal] mkdirdatamysqlmysql_3306 {data, l
-- Add users and groups[Root @ zlm local] # groupadd
[Root @ zlm local] # useradd-g mysql-s/sbin/nologin-d/opt/msyql mysql
-- Create a directory[Root @ zlm local] # mkdir/data/mysql/mysql_3306/{data, logs, tmp}-p
-- Soft link to/usr/local/mysql[Root @ zlm local] # ln-s/opt/mysql/mysql-5.5.39-linux2.6-i686/mysql [root @ zlm local] # ll-l mysql lrwxrwxrwx 1 root 38 Sep 24 00:12 mysql-> /opt/mysql/mysql-5.5.39-linux2.6-i686/
-- Grant permissions[Root @ zlm local] # chown-R mysql: mysql/data/mysql/[root @ zlm local] # chown-R mysql: mysql/usr/local/mysql/
-- Add environment variables[Root @ zlm local] # echo 'export PATH = $ PATH:/usr/local/mysql/bin'>/etc/profile [root @ zlm local] # cd mysql
-- Initialize the database[Root @ zlm mysql] #. /scripts/mysql_install_db -- user = mysql -- defaults-file =/etc/my. cnf Installing MySQL system tables... 140924 0:12:43 [Warning] options -- log-slow-admin-statements, -- log-queries-not-using-indexes and -- log-slow-slave-statements have no effect if -- log_slow_queries is not set OK Filling help tables... 140924 0:12:44 [Warning] options -- log-slow-admin-statements, -- log-queries-not-using-indexes and -- log-slow-slave-statements have no effect if -- log_slow_queries is not set OK
To start mysqld at boot time you have to copy support-files/mysql. server to the right place for your system
Please remember to set a password for the MySQL root USER! To do so, start the server, then issue the following commands:
/Usr/local/mysql/bin/mysqladmin-u root password 'new-password'/usr/local/mysql/bin/mysqladmin-u root-h zlm password' new-password'
Alternatively you can run:/usr/local/mysql/bin/mysql_secure_installation
Which will also give you the option of removing the test databases and anonymous user created by default. This is stronugly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with: cd/usr/local/mysql;/usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl cd/usr/local/mysql-test; perl mysql-test-run.pl
Please report any problems at http://bugs.mysq? L.com/
-- Copy the mysql. server file to/etc/init. d/and rename it mysql.[Root @ zlm mysql] # cp support-files/mysql. server/etc/init. d/mysql cp: overwrite '/etc/init. d/mysql '? Yes
-- Start MySQL[Root @ zlm mysql] # service mysql start Starting MySQL ............... the server quit without updating PID file (/data/mysql/mysql_3306/data/zlm. pid ). [FAILED]
-- View error log error. log (if not defined in/etc/my. cnf, the default format is hostname. err)[Root @ zlm local] # cd/data/mysql/mysql_3306/data/
[Root @ zlm data] # ll total 403024-rw ---- 1 mysql 2824 Sep 24 error. log-rw ---- 1 mysql 104857600 Sep 24 ibdata1-rw ---- 1 mysql 104857600 Sep 24 ib_logfile0-rw ---- 1 mysql 104857600 Sep 24 ib_logfile1 -rw ---- 1 mysql 97685504 Sep 24 ib_logfile2 drwx ------ 2 mysql root 4096 Sep 24 mysql drwx ------ 2 mysql 4096 Se P 24 performance_schema drwx ------ 2 mysql root 4096 Sep 24 test [root @ zlm data] # cat error. log 140924 00:13:33 mysqld_safe Starting mysqld daemon with databases from/data/mysql/mysql_3306/data 140924 0:13:33 [Warning] options -- log-slow-admin-statements, -- log-queries-not-using-indexes and -- log-slow-slave-statements have no effect if -- log_slow_queries is not set 140924 0:13:33 [War Ning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. please use the full name instead. 140924 0:13:33 [Note] Plugin 'Federated 'is disabled. 140924 0:13:33 InnoDB: The InnoDB memory heap is disabled 140924 0:13:33 InnoDB: Mutexes and rw_locks use InnoDB's own implementation 140924 0:13:33 InnoDB: Compressed tables Use zlib 1.2.3 140924 0:13:33 InnoDB: Using Linux native AIO 140924 0:13:33 InnoDB: Initializing buffer pool, size = 128.0 M 140924 0:13:33 InnoDB: Completed initialization of buffer pool InnoDB: The first specified data file. /ibdata1 did not exist: InnoDB: a new database to be created! 140924 0:13:33 InnoDB: Setting file. /ibdata1 size to 100 MB InnoDB: Database physically writes the file full: wait... innoDB: Progress in MB: 100 140924 0:13:40 InnoDB: Log file. /ib_logfile0 did not exist: new to be created InnoDB: Setting log file. /ib_logfile0 size to 100 MB InnoDB: Database physically writes the file full: wait... innoDB: Progress in MB: 100 140924 0:13:43 InnoDB: Log file. /ib_logfile1 did not exist: new to be created InnoDB: Setting log file. /ib_logfile1 size to 100 MB InnoDB: Database physically writes the file full: wait... innoDB: Progress in MB: 100 140924 0:13:44 InnoDB: Log file. /ib_logfile2 did not exist: new to be created InnoDB: Setting log file. /ib_logfile2 size to 100 MB InnoDB: Database physically writes the file full: wait... innoDB: Progress in MB: 140924 0:13:45 InnoDB: Error: Write to file. /ib_logfile2 failed at offset 0 97517568. innoDB: 1048576 bytes shoshould have been written, only 167936 were written. innoDB: Operating system error number 2. innoDB: Check that your OS and file system support files of this size. innoDB: Check also that the disk is not full or a disk quota exceeded. innoDB: Error number 2 means 'no such file or directory '. innoDB: Some operating system error numbers are described at InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html InnoDB: Error in creating. /ib_logfile2: probably out of disk space 140924 0:13:45 [ERROR] Plugin 'innodb' init function returned error. 140924 0:13:45 [ERROR] Plugin 'innodb' registry as a storage engine failed. 140924 0:13:45 [ERROR] Unknown/unsupported storage engine: InnoDB 140924 0:13:45 [ERROR] Aborting
140924 0:13:45 [Note]/usr/local/mysql/bin/mysqld: Shutdown complete
140924 00:13:45 mysqld_safe mysqld from pid file/data/mysql/mysql_3306/data/zlm. pid ended [root @ zlm data] # perror 2 -- perror is the OS error code 2 command used to query Linux error codes: no such file or directory [root @ zlm data] # df-h Filesystem Size Used Avail Use % Mounted on/dev/mapper/VolGroup00-LogVol00 7.7G 7.3G 0 100%/-- disk space usage 100%, no space left/dev/sda1 99 M 12 M 82 M 13%/boot tmpfs 506 M 0 506 M 0%/dev/shm
-- Shutdown and add a disk[Root @ zlm data] # init 0 [root @ zlm ~] # Rm-rf/data -- delete all the data in the existing/data directory first, because it will be lost after remounting, release this part of space in advance [root @ zlm ~] # Fdisk-l
Disk/dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System/dev/sda1 * 1 13 104391 83 Linux/dev/sda2 14 1305 10377990 8e Linux LVM
Disk/dev/sdb: 5368 MB, 5368709120 bytes -- added 1 5 GB Disk, 255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065*512 = 8225280 bytes
Disk/dev/sdb doesn't contain a valid partition table -- not partitioned
-- Partition the newly added disk[Root @ zlm ~] # Fdisk/dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. changes will remain in memory only, until you decide to write them. after that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite)
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-652, default 1): Using default value 1 Last cylinder or + size or + sizeM or + sizeK (1-652, default 652): Using default value 652
Command (m for help): w The partition table has been altered!
Calling ioctl () to re-read partition table. Syncing disks.
-- View disk information[Root @ zlm ~] # Fdisk-l
Disk/dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System/dev/sda1 * 1 13 104391 83 Linux/dev/sda2 14 1305 10377990 8e Linux LVM
Disk/dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System/dev/sdb1 1 652 5237158 + 83 Linux-partitioned
-- Format the ext3 file system[Root @ zlm ~] # Mkfs. ext3/dev/sdb1
Mke2fs 1.39 (29-May-2006) Filesystem label = OS type: Linux Block size = 4096 (log = 2) Fragment size = 4096 (log = 2) 655360 inodes, 1309289 blocks 65464 blocks (5.00%) reserved for the super user First data block = 0 Maximum filesystem blocks = 1342177280 40 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768,983 04, 163840,229 376, 294912,819 200, 884736
Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or 180 days, whichever comes first. Use tune2fs-c or-I to override. [root @ zlm ~] # Mkdir/data/mysql/mysql_3306/{data, logs, tmp}-p [root @ zlm ~] # Mount/dev/sdb1/data [root @ zlm ~] # Df-h Filesystem Size Used Avail Use % Mounted on/dev/mapper/VolGroup00-LogVol00 7.7G 6.9G 398 M 95%/-- you can see that, after restart, some space is released:/dev/sda1 99 M 12 M 82 M 13%/boot tmpfs 506 M 0 506 M 0%/dev/shm/dev/sdb1 5.0G 139 M 4.6G 3%/data --/data directory has been mounted to the new 5G disk
-- To make the mounting persistent, it will not be lost after restart. you need to modify/etc/fstab.[Root @ zlm ~] # Vi/etc/fstab/dev/VolGroup00/LogVol00/ext3 defaults 1 1/dev/VolGroup00/LogVol00/ext3 defaults 1 1 LABEL =/boot ext3 defaults 1 2 tmpfs/ dev/shm tmpfs defaults 0 0 devpts/dev/pts devpts gid = 5, mode = 620 0 0 sysfs/sys sysfs defaults 0 0 proc/proc defaults 0 0/dev/VolGroup00/LogVol01 swap defaults 0 0/data/dev/sdb1 ext3 defaults 0 0 0 -- add this line to the end of the file, specify the correspondence between mounted directories and disks
-- Re-create related directories under/data[Root @ zlm ~] # Cd/data/[root @ zlm data] # ll total 1
Drwx ------ 2 root 16384 Sep 24 lost + found
[Root @ zlm data] # rm-rf lost + found [root @ zlm data] # ll total 0
[Root @ zlm data] # mkdir/data/mysql/mysql_3306/{data, logs, tmp}-p
-- Initialize the database [root @ zlm mysql] # pwd/usr/local/mysql [root @ zlm mysql] # chown-R mysql: mysql/data/mysql/
[Root @ zlm mysql] #./scripts/mysql_install_db -- user = mysql -- defaults-file =/etc/my. cnf
Note that the/data directory must be granted permissions before initialization. Otherwise, an error is reported because the/data directory is re-created and mounted to the sdb1 disk partition, for example, Installation of system tables failed! Examine the logs in/data/mysql/mysql_3306/data for more information.
-- Restart the MySQL service again[Root @ zlm mysql] # service mysql start Starting MySQL ........... [OK] [root @ zlm mysql] # mysql Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 1 Server version: 5.5.39-log MySQL Community Server (GPL)
Copyright (c) 2000,201 4, 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.
(Testing) root @ localhost [(none)]> exit Bye [root @ zlm mysql] # ps aux | grep mysql root 2744 0.4 0.1 4528 1276 pts/0 S/bin/sh/usr/local/mysql/bin/mysqld_safe -- datadir =/data/mysql/mysql_3306/data -- pid-file =/data/mysql/mysql_3306/data/zlm. pid mysql 3452 3.2 3.4 319580 35472 pts/0 Sl/usr/local/mysql/bin/mysqld -- basedir =/usr/local/mysql -- datadir =/data/mysql/ mysql_3306/data -- plugin-dir =/usr/local/mysql/lib/plugin -- user = mysql -- log-error =/data/mysql/mysql_3306/data/error. logs -- open-files-limit = 8192 -- pid-file =/data/mysql/mysql_3306/data/zlm. pid -- socket =/tmp/mysql. sock -- port = 3306 root 3493 0.0 0.0 3912 pts/0 R + grep mysql [root @ zlm mysql] # mysqladmin shutdown [root @ zlm mysql] # ps aux | grep mysql root 3501 0.0 0.0 3912 668 pts/0 R + grep mysql [root @ zlm mysql] #
2nd boot methods:[Root @ zlm mysql] #/etc/init. d/mysql start Starting MySQL... [OK] [root @ zlm mysql] #
3rd boot methods:[Root @ zlm mysql] # mysqld_safe -- defaults-file =/etc/my. cnf & [1] 4612 [root @ zlm mysql] # Starting mysqld daemon with databases from/data/mysql/mysql_3306/data STOPPING server from pid file/data/mysql/mysql_3306/data /zlm. pid 140924 01:09:02 mysqld ended
Failed to start here. check error. log and prompt that The xxx parameter is set improperly, for example: [root @ zlm mysql] # cat error. log 140924 01:03:00 mysqld started
140924 1:03:00 [ERROR]/usr/libexec/mysqld: unknown variable 'slow _ query_log_file = slow. log'
140924 01:03:00 mysqld ended
140924 01:04:54 mysqld started 140924 1:04:54 [ERROR]/usr/libexec/mysqld: unknown variable 'slow _ query_log = 0'
140924 01:04:54 mysqld ended
140924 01:05:39 mysqld started Unknown suffix '. 'used for variable' long _ query_time '(value '0. 5 ') 140924 1:05:39 [ERROR]/usr/libexec/mysqld: Error while setting value '0. 5 'to 'long _ query_time'
140924 01:05:39 mysqld ended
140924 01:06:26 mysqld started 140924 1:06:26 [ERROR]/usr/libexec/mysqld: unknown variable 'min _ examined_row_limit = 100'
140924 01:06:26 mysqld ended
140924 01:09:02 mysqld started 140924 1:09:02 [ERROR]/usr/libexec/mysqld: unknown variable 'General _ log_file = general. log'
140924 01:09:02 mysqld ended
The reason for this problem is that when I installed the RHEL 5.3 operating system, I chose the mysql-5.0.45-7.el 5 RPM package in the system disk, even if it has been deleted. After the rpm Package is installed, mysqld will be copied to the/usr/libexec/Directory. many parameters that can be identified in MySQL 5.5 are not recognized in MySQL 5.0, causing startup failure, always prompt "unknown variable", for example, the following: table_definition_cache table_open_cache slow_query_log_file
Slow_query_log
Long_query_time
Min_examined_row_limit...
Solution: -- Use the new mysqld executable file to overwrite the original mysqld under/usr/libexec, and then start it in mysqld_safe & mode. [Root @ zlm mysql] # cp/usr/local/mysql/bin/mysqld/usr/libexec/mysqld
Cp: overwrite '/usr/libexec/mysqld '? Yes
[Root @ zlm mysql] # mysqld_safe -- defaults-file =/etc/my. cnf &
[1] 4687 Starting mysqld daemon with databases from/data/mysql/mysql_3306/data
This line will be stopped all the time. press ctrl + c to return to the shell command line again.
-- View the mysql process[Root @ zlm mysql] # ps aux | grep mysql root 4687 0.0 0.1 4484 pts/0 S 0/ bin/sh/usr/bin/mysqld_safe -- defaults-file =/ etc/my. cnf mysql 4721 0.0 3.1 329828 32704 pts/0 Sl 0/ usr/libexec/mysqld -- defaults-file =/etc/my. cnf -- basedir =/usr/local/mysql -- datadir =/data/mysql/mysql_3306/data -- user = mysql -- pid-file =/data/mysql/mysql_3306/data/zlm. pid -- skip-external-locking -- port = 3306 -- socket =/tmp/mysql. sock root 4768 0.0 0.0 3912 668 pts/0 R + grep mysql
We can see that mysqld_safe has been successfully started. Note that this method is better than mysqld. even if you kill the mysqld process, mysqld_safe can ensure that the mysqld process is restarted
[Root @ zlm mysql] # ps aux | grep mysql root 5134 0.5 0.1 4484 pts/0 S 0/ bin/sh/usr/bin/mysqld_safe -- defaults-file =/ etc/my. cnf mysql 5171 2.4 3.1 319584 32708 pts/0 Sl 0/ usr/libexec/mysqld -- defaults-file =/etc/my. cnf -- basedir =/usr/local/mysql -- datadir =/data/mysql/mysql_3306/data -- user = mysql -- pid-file =/data/mysql/mysql_3306/data/zlm. pid -- skip-external-locking -- port = 3306 -- socket =/tmp/mysql. sock root 5193 0.0 0.0 3912 668 pts/0 R + grep mysql [root @ zlm mysql] # kill-9 5171 [root @ zlm mysql] #/usr/bin/mysqld_safe: line 388: 5171 Killed nohup/usr/libexec/mysqld -- defaults-file =/etc/my. cnf -- basedir =/usr/local/mysql -- datadir =/data/mysql/mysql_3306/data -- user = mysql -- pid-file =/data/mysql/mysql_3306/data/zlm. pid -- skip-external-locking -- port = 3306 -- socket =/tmp/mysql. sock> error. log 2> & 1
Number of processes running now: 0 140924 01:32:54 mysqld restarted press ctrl + c to return to the shell command line
[Root @ zlm mysql] # ps-ef | grep mysql root 5134 2531 0 00:00:00 pts/0/bin/sh/usr/bin/mysqld_safe -- defaults-file =/etc/ my. cnf mysql 5205 5134 0 000:00:00 pts/0/usr/libexec/mysqld -- defaults-file =/etc/my. cnf -- basedir =/usr/local/mysql -- datadir =/data/mysql/mysql_3306/data -- user = mysql -- pid-file =/data/mysql/mysql_3306/data/zlm. pid -- skip-external-locking -- port = 3306 -- socket =/tmp/mysql. sock root 5229 2531 0 00:00:00 pts/0 grep mysql
The mysqld_safe process is still 5134, but the mysqld process 5171 that has just been killed has become 5205. In fact, mysqld_safe is the Daemon of mysqld, which is used to ensure the normal operation of mysqld, when we run mysqld_safe & to start MySQL, we finally call the mysqld command.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.