Archive for the tag 'mySQL'

SBDavid

MariaDB versus MySQL - Compatibility

MariaDB versus MySQL - Compatibility

MariaDB is a binary drop in replacement for MySQL

For all practical purposes, MariaDB is a binary drop in replacement of the same MySQL version (for example MySQL 5.1 -> MariaDB 5.1, MariaDB 5.2 & MariaDB 5.3 are compatible. MySQL 5.5 will be compatible with MariaDB 5.5). What this means is that:

Data and table definition files (.frm) files are binary compatible.
All client APIs, protocols and structs are identical.
All filenames, binaries, paths, ports, sockets, and etc… should be the same.
All MySQL connectors (PHP, Perl, Python, Java, .NET, MyODBC, Ruby, MySQL C connector etc) work unchanged with MariaDB.

There are some installation issues with PHP5 that you should be aware of (a bug in how the old PHP5 client checks library compatibility).
The mysql-client package also works with MariaDB server.
The shared client library is binary compatible with MySQL’s client library.

This means that for most cases, you can just uninstall MySQL and install MariaDB and you are good to go. (No need to convert any datafiles if you use same main version, like 5.1).

Reference : https://kb.askmonty.org/

ERROR 2006: MySQL Server has gone away

When trying to load a large SQL dump, I get ERROR 2006: MySQL Server has gone away.

Version 5.0: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
Version 5.5: http://dev.mysql.com/doc/refman/5.5/en/gone-away.html

Most likely, you will need to restart mysqld with the -O max_allowed_packet=# option.

A communication packet is a single SQL statement sent to the MySQL server, a single row that is sent to the client, or a binary log event sent from a master replication server to a slave.

The largest possible packet that can be transmitted to or from a MySQL 5.1 server or client is 1GB.

Plesk - how do I enable remote access to MySQL database server?

Sometimes you need to provide the remote access.

Open /etc/my.cnf and make sure that the following lines exists/commented in [mysqld] section:

[mysqld]
port = 3306
bind-address = 10.10.0.1
# skip-networking

Restart MySQL. Now you should grant access to remote IP address, login to Mysql:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` mysql

For example if you want to allow access to database called ‘foo’ for user ‘bar’ and remote IP 192.168.0.1 then you need to type following commands at “mysql>” prompt:

mysql> GRANT ALL ON foo.* TO bar@’192.168.0.1′ IDENTIFIED BY ‘PASSWORD’;
mysql> REVOKE GRANT OPTION ON foo.* FROM bar@’192.168.0.1′;

Reference: http://kb.parallels.com/

SBDavid

Mysql Tables

Mysql Tables

Each database will contain one or more tables once an application starts storing data in it. The application should usually be what creates tables and modifies them.

List tables

Use the “show tables” command to list the tables in a database:

SHOW TABLES FROM databasename;

Count the rows in a table

A simple query to count the number of rows (entries) in a table would look like:

SELECT COUNT(*) FROM databasename.tablename;

Show all data in a table

To list absolutely every entry in a table, run:

SELECT * FROM databasename.tablename;

Note that this will usually be a huge result. You can list just the fields you want to view from each entry by listing them in place of “*” above, separating them with commas.

cPanel Daily Process Log (formerly CPU/Memory/MySQL Usage)

(Main –>> Server –>> Daily Process Log)

This feature displays information about your server’s consumption of processing power and memory, averaged over the course of the selected day.

The information is divided into rows and columns. Each row represents a different process running on your server while each column represents the processes’ associated parameters.

The processes running on your server will depend on how you have configured WHM and what other daemons and applications you install on your server.

The column information is divided into 5 categories:

User — Displays the name of the user running the process. For example, if you are logged into your server as “root,” then that username will appear in this field for any processes you initiate.
Domain — Displays the domain name associated with your cPanel user accounts.
%CPU — Displays the average daily percentage of the CPU’s processing power used by the corresponding process.
%MEM — Displays the average daily percentage of RAM used by the corresponding process.
MySQL Processes — Displays the average number of MySQL processes associated with the corresponding process for today.

Next »