I were install MariaDB on Macbook using brew.
In brew web site. They told.
MariaDB 10.2 is the current stable release of MariaDB. It is built on
MariaDB 10.1 with features from MySQL 5.6 & 5.7, and entirely new
features not found anywhere else.
But when I install and connect with Sequel Pro. On top of program. It show
(MySQL 5.5.5-10.2.6-MariaDB)
I want to make MySQL version to 5.7, Because I want to use JSON column.
How can i solve this issue.
You have got the right version, it is 10.2.6. The prefix 5.5.5 is not to worry about, you can ignore it.
It was added in 10.x versions to allow communicating with old or non-compliant servers/clients/applications which check the version number and refuse to communicate if it's not 5.x.
MariaDB clients strip the prefix, but third-party ones sometimes don't.
That said, please note that MariaDB 10.2.6 does not have JSON column type. It has all the same JSON functions as MySQL 5.7, and a few more, but there is no type, you cannot say CREATE TABLE t (j JSON). The values are supposed to be stored in a regular TEXT/BLOB column.
MariaDB documentation says:
version
Description: Server version number. It may also include a
suffix with configuration or build information.
[...]
From MariaDB 10.2.1, this variable can be set at startup in order to
fake the server version.
If left at its default value, old clients will be presented with a compatible InnoDB version number (e.g.: 5.5.5) despite the variable is internally different:
root#host:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 180
Server version: 5.5.5-10.2.13-MariaDB-10.2.13+maria~xenial-log mariadb.org binary distribution
[...]
mysql> show variables like 'version';
+---------------+------------------------------------------+
| Variable_name | Value |
+---------------+------------------------------------------+
| version | 10.2.13-MariaDB-10.2.13+maria~xenial-log |
+---------------+------------------------------------------+
1 row in set (0.00 sec)
[...]
mysql> show variables like 'innodb_version';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| innodb_version | 5.7.21 |
+----------------+--------+
1 row in set (0.00 sec)
In order to force the version shown to the clients, add this to the [mariadb] section of the server's configuration file:
[mariadb]
version = 5.7.21-10.2.13-MariaDB-10.2.13+maria~xenial-log
The output should be as follows:
root#host:~# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 40
Server version: 5.7.21-10.2.13-MariaDB-10.2.13+maria~xenial-log mariadb.org binary distribution
[...]
mysql> show variables like 'version';
+---------------+-------------------------------------------------+
| Variable_name | Value |
+---------------+-------------------------------------------------+
| version | 5.7.21-10.2.13-MariaDB-10.2.13+maria~xenial-log |
+---------------+-------------------------------------------------+
1 row in set (0.00 sec)
Related
I am having a problem with BLOB fields in my MySQL database - when uploading files larger than approx 1MB I get an error Packets larger than max_allowed_packet are not allowed.
Here is what i've tried:
In MySQL Query Browser I ran a show variables like 'max_allowed_packet' which gave me 1048576.
Then I execute the query set global max_allowed_packet=33554432 followed by show variables like 'max_allowed_packet' - it gives me 33554432 as expected.
But when I restart the MySQL server it magically goes back to 1048576. What am I doing wrong here?
Bonus question, is it possible to compress a BLOB field?
Change in the my.ini or ~/.my.cnf file by including the single line under [mysqld] or [client] section in your file:
max_allowed_packet=500M
then restart the MySQL service and you are done.
See the documentation for further information.
The max_allowed_packet variable can be set globally by running a query.
However, if you do not change it in the my.ini file (as dragon112 suggested), the value will reset when the server restarts, even if you set it globally.
To change the max allowed packet for everyone to 1GB until the server restarts:
SET GLOBAL max_allowed_packet=1073741824;
One of my junior developers was having a problem modifying this for me so I thought I would expand this in greater detail for linux users:
open terminal
ssh root#YOURIP
enter root password
nano /etc/mysql/my.cnf (if command is not recognized do this first or try vi then repeat: yum install nano )
add the line: max_allowed_packet=256M (obviously adjust size for whatever you need) under the [MYSQLD] section. He made a mistake of putting it at the bottom of the file first so it did not work.
Control + O (save) then Enter (confirm) then Control + X (exit file)
service mysqld restart
You can check the change in the variables section on phpmyadmin
I think some would also want to know how to find the my.ini file on your PC. For windows users, I think the best way is as follows:
Win+R(shortcut for 'run'), type services.msc, Enter
You could find an entry like 'MySQL56', right click on it, select properties
You could see sth like "D:/Program Files/MySQL/MySQL Server 5.6/bin\mysqld" --defaults-file="D:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56
I got this answer from http://bugs.mysql.com/bug.php?id=68516
Following all instructions, this is what I did and worked:
mysql> SELECT CONNECTION_ID();//This is my ID for this session.
+-----------------+
| CONNECTION_ID() |
+-----------------+
| 20 |
+-----------------+
1 row in set (0.00 sec)
mysql> select #max_allowed_packet //Mysql do not found #max_allowed_packet
+---------------------+
| #max_allowed_packet |
+---------------------+
| NULL |
+---------------------+
1 row in set (0.00 sec)
mysql> Select ##global.max_allowed_packet; //That is better... I have max_allowed_packet=32M inside my.ini
+-----------------------------+
| ##global.max_allowed_packet |
+-----------------------------+
| 33554432 |
+-----------------------------+
1 row in set (0.00 sec)
mysql> **SET GLOBAL max_allowed_packet=1073741824**; //Now I'm changing the value.
Query OK, 0 rows affected (0.00 sec)
mysql> select #max_allowed_packet; //Mysql not found #max_allowed_packet
+---------------------+
| #max_allowed_packet |
+---------------------+
| NULL |
+---------------------+
1 row in set (0.00 sec)
mysql> Select ##global.max_allowed_packet;//The new value. And I still have max_allowed_packet=32M inisde my.ini
+-----------------------------+
| ##global.max_allowed_packet |
+-----------------------------+
| 1073741824 |
+-----------------------------+
1 row in set (0.00 sec)
So, as we can see, the max_allowed_packet has been changed outside from my.ini.
Lets leave the session and check again:
mysql> exit
Bye
C:\Windows\System32>mysql -uroot -pPassword
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.6.26-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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.
mysql> SELECT CONNECTION_ID();//This is my ID for this session.
+-----------------+
| CONNECTION_ID() |
+-----------------+
| 21 |
+-----------------+
1 row in set (0.00 sec)
mysql> Select ##global.max_allowed_packet;//The new value still here and And I still have max_allowed_packet=32M inisde my.ini
+-----------------------------+
| ##global.max_allowed_packet |
+-----------------------------+
| 1073741824 |
+-----------------------------+
1 row in set (0.00 sec)
Now I will stop the server
2016-02-03 10:28:30 - Server is stopped
mysql> SELECT CONNECTION_ID();
ERROR 2013 (HY000): Lost connection to MySQL server during query
Now I will start the server
2016-02-03 10:31:54 - Server is running
C:\Windows\System32>mysql -uroot -pPassword
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.26-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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.
mysql> SELECT CONNECTION_ID();
+-----------------+
| CONNECTION_ID() |
+-----------------+
| 9 |
+-----------------+
1 row in set (0.00 sec)
mysql> Select ##global.max_allowed_packet;//The previous new value has gone. Now I see what I have inside my.ini again.
+-----------------------------+
| ##global.max_allowed_packet |
+-----------------------------+
| 33554432 |
+-----------------------------+
1 row in set (0.00 sec)
Conclusion, after SET GLOBAL max_allowed_packet=1073741824, the server will have the new max_allowed_packet until it is restarted, as someone stated previously.
If getting this error while performing a backup, max_allowed_packet can be set in the my.cnf particularly for mysqldump.
[mysqldump]
max_allowed_packet=512M
I kept getting this error while performing a mysqldump and I did not understand because I had this set in my.cnf under the [mysqld] section. Once I figured out I could set it for [mysqldump] and I set the value, my backups completed without issue.
For those running wamp mysql server
Wamp tray Icon -> MySql -> my.ini
[wampmysqld]
port = 3306
socket = /tmp/mysql.sock
key_buffer_size = 16M
max_allowed_packet = 16M // --> changing this wont solve
sort_buffer_size = 512K
Scroll down to the end until u find
[mysqld]
port=3306
explicit_defaults_for_timestamp = TRUE
Add the line of packet_size in between
[mysqld]
port=3306
max_allowed_packet = 16M
explicit_defaults_for_timestamp = TRUE
Check whether it worked with this query
Select ##global.max_allowed_packet;
This error come because of your data contain larger then set value.
Just write down the max_allowed_packed=500M
or you can calculate that 500*1024k and use that instead of 500M if you want.
Now just restart the MySQL.
For anyone running MySQL on Amazon RDS service, this change is done via parameter groups. You need to create a new PG or use an existing one (other than the default, which is read-only).
You should search for the max_allowed_packet parameter, change its value, and then hit save.
Back in your MySQL instance, if you created a new PG, you should attach the PG to your instance (you may need a reboot).
If you changed a PG that was already attached to your instance, changes will be applied without reboot, to all your instances that have that PG attached.
Many of the answerers spotted the issue and already gave the solution.
I just want to suggest another solution, which is changing the Glogal variable value from within the tool Mysql Workbench. That is ofcourse IF you use Workbench running locally on server (or via SSH connection)
You just connect to your instance and go on menu:
Server -> Options File -> Networking -> max_allowed_packed
You set the desired value and then you need to restart MySql Service.
Set the max allowed packet size using MySql Workbench and restart the server
in MYSQL 5.7, max_allowed_packet is at most 1G. if you want to set it to 4G, it would failed without error and warning.
If you want upload big size image or data in database. Just change the data type to 'BIG BLOB'.
set global max_allowed_packet=10000000000;
I used to have mySQL installed in my Rails app and everything was good until I had to install MariaDB (because Sphinx is not compatible with mysql 8).
After deleting the database and recreating it, my I getting this:
rails db:create
Database 'xxx_dev' already exists
Database 'db/test.sqlite3' already exists
but if I start mysql I get this:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.3.13-MariaDB Homebrew
.....
MariaDB [(none)]> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
My Rails app connects to the db using sockets. Apparently, they are not using the same MySql instance (I brew uninstalled everything but MariaDB).
Looking at the mariadb logs, I am seeing all the passwords logged in as clear text like IDENTIFIED BY . Is there any option or way yo suppress this. This is a huge security risk.
Any help is appreciated.
MariaDB [(none)]> SHOW VARIABLES LIKE "%version%";
+-------------------------+-----------------------------------+
| Variable_name | Value |
+-------------------------+-----------------------------------+
| innodb_version | 5.5.41-MariaDB-37.0 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.5.42-MariaDB-wsrep |
| version_comment | MariaDB Server, wsrep_25.11.r4026 |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+-----------------------------------+
If you use audit plug-in v1.2 or newer, then mariadb masks the passwords in certain queries. Specifically:
Since version 1.2.0, passwords have been replaced by asterisks in the logs for certain queries, including:
GRANT, CREATE USER, CREATE MASTER, CREATE SERVER, ALTER SERVER
Passwords given with the PASSWORD() and OLD_PASSWORD() functions in
DML statements will still be logged as plain text in queries, as will
key strings used with encrypt functions such as ENCODE() and
AES_ENCRYPT().
Furthermore, you can protect the log files via traditional means by restricting access rights, using file system level encryption. Really, only DBAs should have access to server logs and they can pretty much do anything in the db anyway.
The clear text password is not only logged in the MariaDB logs but it might be also logged in the .mysql_history file of the user that connected to MariaDB and performed some
CREATE/GRANT/etc.. IDENTIFIED BY 'some_cleartext_password'
You can find .mysql_history in /home/username or in /root if you connected as root.
Best way to avoid such things to happen is to replace the syntax
CREATE/GRANT/etc.. IDENTIFIED BY 'some_cleartext_password'
with
CREATE/GRANT/etc.. IDENTIFIED BY PASSWORD 'hashed_password'
You can calculate the hashed password either in your application that is calling MariaDB or by using the PASSWORD() function of MariaDB. For example:
SELECT PASSWORD('some_cleartext_password')
Do the above select on another MariaDB/MySQL server if you don't want the above query to be logged, in which case you will end-up with the same problem. :-)
I'm doing some MYSQL work for a company, and I need to know if they have an ENTERPRISE or COMMUNITY edition. I researched this, and according to the mysql reference pages, I should be able to use the "status" command. According to that reference, the "Server Version" should say "Community", or "enterprise". Ours says neither (figures, right?), just "5.0.77 Source Distribution". Is there another way to tell?
tl;dr
Try this:
mysql> SHOW VARIABLES LIKE "%version%";
Normal answer
Using a command client (mysql), the server version of the MySQL server to which you are connected is shown once you are connected. The server version information includes community or enterprise accordingly.
For example, here is the output from a MySQL Community Server edition installed on Linux:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.27-standard MySQL Community Edition - Standard (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
This is an example of the output from MySQL Enterprise Server on Windows:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.28-enterprise-gpl-nt MySQL Enterprise Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
You may also determine the version information using the version variables. Both the version and version_comment variables contain version information for the server to which you are connected. Use the SHOW VARIABLES statement to obtain the information you want, as shown in this example:
mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------------------+
| protocol_version | 10 |
| version | 5.0.27-standard |
| version_comment | MySQL Community Edition - Standard (GPL) |
| version_compile_machine | i686 |
| version_compile_os | pc-linux-gnu |
+-------------------------+------------------------------------------+
5 rows in set (0.04 sec)
Straight from the documentation.
But, of course, so is STATUS;
The STATUS command displays the version as well as version comment information. For example:
mysql> STATUS;
--------------
./client/mysql Ver 14.12 Distrib 5.0.29, for pc-linux-gnu (i686) using readline 5.0
Connection id: 8
Current database:
Current user: mc#localhost
SSL: Not in use
Current pager: /usr/bin/less
Using outfile: ''
Using delimiter: ;
Server version: 5.0.27-standard MySQL Community Edition - Standard (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /tmp/mysql.sock
Uptime: 1 day 3 hours 58 min 43 sec
Threads: 2 Questions: 17 Slow queries: 0 Opens: 11 Flush tables: 1 Open tables: 6 Queries per second avg: 0.000
--------------
So I wonder whether you're actually just looking at the first line provided or whether you're checking below for the "Server version" line.
If nothing works for you then feel free to edit your question with a complete dump of what you get.
Edit
As you found out it appears that they do not disquisition between the releases since it's a specific edition release, in this case a Community Edition. Thus the answer generally only works if you can't be certain by looking up the version.
I am having a problem with BLOB fields in my MySQL database - when uploading files larger than approx 1MB I get an error Packets larger than max_allowed_packet are not allowed.
Here is what i've tried:
In MySQL Query Browser I ran a show variables like 'max_allowed_packet' which gave me 1048576.
Then I execute the query set global max_allowed_packet=33554432 followed by show variables like 'max_allowed_packet' - it gives me 33554432 as expected.
But when I restart the MySQL server it magically goes back to 1048576. What am I doing wrong here?
Bonus question, is it possible to compress a BLOB field?
Change in the my.ini or ~/.my.cnf file by including the single line under [mysqld] or [client] section in your file:
max_allowed_packet=500M
then restart the MySQL service and you are done.
See the documentation for further information.
The max_allowed_packet variable can be set globally by running a query.
However, if you do not change it in the my.ini file (as dragon112 suggested), the value will reset when the server restarts, even if you set it globally.
To change the max allowed packet for everyone to 1GB until the server restarts:
SET GLOBAL max_allowed_packet=1073741824;
One of my junior developers was having a problem modifying this for me so I thought I would expand this in greater detail for linux users:
open terminal
ssh root#YOURIP
enter root password
nano /etc/mysql/my.cnf (if command is not recognized do this first or try vi then repeat: yum install nano )
add the line: max_allowed_packet=256M (obviously adjust size for whatever you need) under the [MYSQLD] section. He made a mistake of putting it at the bottom of the file first so it did not work.
Control + O (save) then Enter (confirm) then Control + X (exit file)
service mysqld restart
You can check the change in the variables section on phpmyadmin
I think some would also want to know how to find the my.ini file on your PC. For windows users, I think the best way is as follows:
Win+R(shortcut for 'run'), type services.msc, Enter
You could find an entry like 'MySQL56', right click on it, select properties
You could see sth like "D:/Program Files/MySQL/MySQL Server 5.6/bin\mysqld" --defaults-file="D:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56
I got this answer from http://bugs.mysql.com/bug.php?id=68516
Following all instructions, this is what I did and worked:
mysql> SELECT CONNECTION_ID();//This is my ID for this session.
+-----------------+
| CONNECTION_ID() |
+-----------------+
| 20 |
+-----------------+
1 row in set (0.00 sec)
mysql> select #max_allowed_packet //Mysql do not found #max_allowed_packet
+---------------------+
| #max_allowed_packet |
+---------------------+
| NULL |
+---------------------+
1 row in set (0.00 sec)
mysql> Select ##global.max_allowed_packet; //That is better... I have max_allowed_packet=32M inside my.ini
+-----------------------------+
| ##global.max_allowed_packet |
+-----------------------------+
| 33554432 |
+-----------------------------+
1 row in set (0.00 sec)
mysql> **SET GLOBAL max_allowed_packet=1073741824**; //Now I'm changing the value.
Query OK, 0 rows affected (0.00 sec)
mysql> select #max_allowed_packet; //Mysql not found #max_allowed_packet
+---------------------+
| #max_allowed_packet |
+---------------------+
| NULL |
+---------------------+
1 row in set (0.00 sec)
mysql> Select ##global.max_allowed_packet;//The new value. And I still have max_allowed_packet=32M inisde my.ini
+-----------------------------+
| ##global.max_allowed_packet |
+-----------------------------+
| 1073741824 |
+-----------------------------+
1 row in set (0.00 sec)
So, as we can see, the max_allowed_packet has been changed outside from my.ini.
Lets leave the session and check again:
mysql> exit
Bye
C:\Windows\System32>mysql -uroot -pPassword
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.6.26-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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.
mysql> SELECT CONNECTION_ID();//This is my ID for this session.
+-----------------+
| CONNECTION_ID() |
+-----------------+
| 21 |
+-----------------+
1 row in set (0.00 sec)
mysql> Select ##global.max_allowed_packet;//The new value still here and And I still have max_allowed_packet=32M inisde my.ini
+-----------------------------+
| ##global.max_allowed_packet |
+-----------------------------+
| 1073741824 |
+-----------------------------+
1 row in set (0.00 sec)
Now I will stop the server
2016-02-03 10:28:30 - Server is stopped
mysql> SELECT CONNECTION_ID();
ERROR 2013 (HY000): Lost connection to MySQL server during query
Now I will start the server
2016-02-03 10:31:54 - Server is running
C:\Windows\System32>mysql -uroot -pPassword
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.26-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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.
mysql> SELECT CONNECTION_ID();
+-----------------+
| CONNECTION_ID() |
+-----------------+
| 9 |
+-----------------+
1 row in set (0.00 sec)
mysql> Select ##global.max_allowed_packet;//The previous new value has gone. Now I see what I have inside my.ini again.
+-----------------------------+
| ##global.max_allowed_packet |
+-----------------------------+
| 33554432 |
+-----------------------------+
1 row in set (0.00 sec)
Conclusion, after SET GLOBAL max_allowed_packet=1073741824, the server will have the new max_allowed_packet until it is restarted, as someone stated previously.
If getting this error while performing a backup, max_allowed_packet can be set in the my.cnf particularly for mysqldump.
[mysqldump]
max_allowed_packet=512M
I kept getting this error while performing a mysqldump and I did not understand because I had this set in my.cnf under the [mysqld] section. Once I figured out I could set it for [mysqldump] and I set the value, my backups completed without issue.
For those running wamp mysql server
Wamp tray Icon -> MySql -> my.ini
[wampmysqld]
port = 3306
socket = /tmp/mysql.sock
key_buffer_size = 16M
max_allowed_packet = 16M // --> changing this wont solve
sort_buffer_size = 512K
Scroll down to the end until u find
[mysqld]
port=3306
explicit_defaults_for_timestamp = TRUE
Add the line of packet_size in between
[mysqld]
port=3306
max_allowed_packet = 16M
explicit_defaults_for_timestamp = TRUE
Check whether it worked with this query
Select ##global.max_allowed_packet;
This error come because of your data contain larger then set value.
Just write down the max_allowed_packed=500M
or you can calculate that 500*1024k and use that instead of 500M if you want.
Now just restart the MySQL.
For anyone running MySQL on Amazon RDS service, this change is done via parameter groups. You need to create a new PG or use an existing one (other than the default, which is read-only).
You should search for the max_allowed_packet parameter, change its value, and then hit save.
Back in your MySQL instance, if you created a new PG, you should attach the PG to your instance (you may need a reboot).
If you changed a PG that was already attached to your instance, changes will be applied without reboot, to all your instances that have that PG attached.
Many of the answerers spotted the issue and already gave the solution.
I just want to suggest another solution, which is changing the Glogal variable value from within the tool Mysql Workbench. That is ofcourse IF you use Workbench running locally on server (or via SSH connection)
You just connect to your instance and go on menu:
Server -> Options File -> Networking -> max_allowed_packed
You set the desired value and then you need to restart MySql Service.
Set the max allowed packet size using MySql Workbench and restart the server
in MYSQL 5.7, max_allowed_packet is at most 1G. if you want to set it to 4G, it would failed without error and warning.
If you want upload big size image or data in database. Just change the data type to 'BIG BLOB'.
set global max_allowed_packet=10000000000;