Anda di halaman 1dari 4

My Sql known errors and solutions: ================================= Q.

I am getting an error that read as follows: MySQL: got error 28 from server handler A. This error means no space left on hard disk. According to official MySQL docs , "If you get his error, you need to check all filesystems where MySQL operates. It may be single filesystem or as we recommend you can have datadir, tmpdir and log files split into dedicated filesystems." Solution a) Stop mysql server # /etc/init.d/mysql stop # /etc/init.d/mysqld stop b) Check filesystem and /tmp directories: $ df -h $ cd /tmp $ df -h /tmp c) Remove files from /tmp to free up space: # cd /tmp # rm -rf * d) Look into /var/log directory and remove or compress logs file. e) Use myisamchk command to check and repair of ISAM table: # cd /var/lib/mysql # myisamchk f) Increase disk space (add new hard disk or remove unwanted software(s) ) g) Start the mysql server: # /etc/init.d/mysql start OR # /etc/init.d/mysqld start ======================================= Can t connect to local MySQL server through socket To solve this problem take the following steps. Is MySQL Running? Type the following command # service mysqld status If mysqld is not running, start it: # service mysqld start Try mysql command again as follows: $ mysql -u USER -p Is MySQL Installed? Make sure the package mysql-server is installed: # rpm -qa mysql-server Sample outputs: mysql-server-5.1.61-4.el6.x86_64 If you do not see package name, type the following command to install mysql-serv er: # yum install mysql-server Turn on mysqld to start automatically on boot: # chkconfig mysqld on Run mysqld service, enter: # service mysqld start Set a new root password for mysql server: /var/lib/mysql/mysql.sock (2)

# mysqladmin -u root password 'MySQL-Root-User-Password' ============================================== ERROR 1018 (HY000): Can t read dir of ./dbname/ (errno: 13) When I run the following command at mysql> I get an error which read as follows: mysql> use dbname; mysql> show tables; ERROR 1018 (HY000): Can't read dir of './dbname/' (errno: 13) How do I fix this problem under Debian Linux? To fix this problem you need to set correct permission on /var/lib/mysql/dbname/ directory. Use the command as follows: cd /var/lib/mysql/ ls -l chown mysql:mysql dbname/ -R Replace dbname with actual database directory name. Now you can connect to your mysql server: mysql -u user -p dbname -e 'show tables;' ============================================= MySQL: Set Cache Size: How do I set query cache under MySQL running under UNIX / Linux / BSD or Windows operating systems? MySQL has a great feature called "Query Cache". It allows you to improve MySQL s erver performance. It is quite useful to speed up third party application and/or low load applications. Enabling MySQL Query Cache Edit MySQL config file such as /etc/my.cnf: # vi /etc/my.cnf Append /modify config directives as follows: query_cache_size = 268435456 query_cache_type=1 query_cache_limit=1048576 In above example the maximum size of individual query results that can be cached set to 1048576 using query_cache_limit system variable. Memory size in defined in Kb. The query_cache_size defines the amount of memory allocated for caching q uery results. The default value is 0, which disables the query cache. The allowa ble values are multiples of 1024; other values are rounded down to the nearest m ultiple. Once done restart mysql server. Please note that this is not distribute d caching solution. Distributed MySQL Caching Solution Memcached is one of most popular distributed caching system. This software is hi ghly recommend if you got busy website or mysql server. ============================================ /usr/libexec/mysqld: Incorrect key file for table ir It Error and Solution ./DBNAME/TABLE_NAME.MYI ; Try To Repa

There are two ways to fix this error and repair mysql table. Method # 1: Use MySQL Command Line Login as root user, enter (app2_db is database name): $ mysql -u root -p app2_db

To check table called aix_data_user, enter at the following mysql> prompt: mysql> check table aix_data_user; Sample outputs: +---------------------+-------+----------+---------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +---------------------+-------+----------+---------------------------------------------------------+ | table aix_data_user | check | warning | Table is marked as crashed | | table aix_data_user | check | warning | 2 clients are using or haven't closed the table properly | | table aix_data_user | check | error | record delete-link-chain corrupted | | table aix_data_user | check | error | Corrupt | +---------------------+-------+----------+---------------------------------------------------------+ 4 rows in set (0.00 sec) [Warning examples may crash your computer] WARNING! It is best to make a backup of a table before performing a table repair operation; under some circumstances the operation might cause data loss. Possible causes include but are not limited to file system errors. Type the following sql command to repair the aix_data_user table, enter: mysql> repair table aix_data_user; Sample outputs: +---------------------+--------+----------+----------+ | Table | Op | Msg_type | Msg_text | +---------------------+--------+----------+----------+ | table aix_data_user | repair | status | OK | +---------------------+--------+----------+----------+ 1 row in set (0.00 sec) Option #2: Use mysqlcheck Command The mysqlcheck command is used to checks, repairs, optimizes, and analyzes mysql tables. The general syntax is as follows: mysqlcheck [options] db_name [tables] mysqlcheck -u userName -p db_name table1 To check aix_data_user table, enter: $ mysqlcheck -u root -p app2_db aix_data_user Sample outputs: Enter password: aix_data_user OK

To repair the table pass the --auto-repair option to mysqlcheck command: $ mysqlcheck --auto-repair -u root -p app2_db aix_data_user ============================================================

Anda mungkin juga menyukai