HostOnNet Blog

Category Archives: MySQL

InnoDB: mmap(x bytes) failed; errno 12

On a VPS, MariaDB refused to start with error [root@ip-10-0-51-171 mariadb]# service mariadb start Redirecting to /bin/systemctl start mariadb.service Job for mariadb.service failed because the control process exited with error code. See “systemctl status mariadb.service” and “journalctl -xe” for details.

Repair MySQL database with mysqlcheck

mysqlcheck command can be used to check, repair, optimize or analyzes tables in a MySQL database. To check a database for errors, run If you database need user name and password, specify it with -u USER-NAME -p, for example This

PHP can’t connect to MySQL running on localhost

On a server, PHP can’t connect to MySQL with following code, it returned error “Could not connect: Permission denied 2002” If i change “localhost” with IP address 127.0.0,1, PHP script is able to connect to MySQL server properly. If i

MySQL Configuration

Here are some of the configurations for MySQL, some of these are already set on your server. When you edit MySQL configuration file (/etc/my.cnf or /etc/mysql/my.cnf), you need to restart MySQL as it is only read when you start MySQL.

InnoDB Error log file ib_logfile0 is of different size

After copying MySQL data (/var/lib/mysql) folder from one server to another, MariaDB failed to start. On checking log, found following error InnoDB: Error: log file ./ib_logfile0 is of different size 0 268435456 bytes InnoDB: than specified in the .cnf file

MySQL Can’t open and lock privilege tables

Recently on of the server had its HDD failed. After moving MySQL data (/var/lib/mysql) to another server MySQL (MariaDB) would not start. On checking log file, i got following errors 170314 14:48:09 Percona XtraDB ( 5.5.49-MariaDB-38.0 started; log sequence number

Secure MySQL Installation with mysql_secure_installation

On Ubuntu 16.04, after MySQL (MariaDB) installed, you have no root password. Root is able to login with out any password. To set root password for MySQL, after installation, run You will be asked to set new password, also allow

MySQL Show all Supported Database Engines

To list all supported Database Engines in MySQL run Example MariaDB [(none)]> show engines; +——————–+———+—————————————————————————-+————–+——+————+ | Engine | Support | Comment | Transactions | XA | Savepoints | +——————–+———+—————————————————————————-+————–+——+————+ | CSV | YES | CSV storage engine | NO |

Storing MySQL password in .my.cnf

Create ~/.my.cnf file Edit file Add following content Now you will be able to login to server with out password.

Reset MySQL root password

To reset MySQL root password, first stop MySQL server Stop MySQL Server If that did not work, one of the following command may work for you. Start MySQL with out Password Connect to MySQL Now open another terminal, run To