Remove length restrictions on GROUP_CONCAT() [duplicate] - mysql

This question already has answers here:
MySQL "Row 30153 was cut by GROUP_CONCAT()" error
(2 answers)
Closed 4 years ago.
I came across a poorly designed MySql table by previous developer where I need to group_concat very long strings. Due to my company’s contract I’m not allowed to alter the design (nor change the query). I’m looking for a way to increase the length of the output. I came across a query with which a length can be set but valid for a single session.
Edit 1:
Suggestion provided by Madhur Bhaiya is not persistent, it only holds true for a given session.

To make changes for a specific session, you can use the following:
SET GLOBAL group_concat_max_len=15000;
Also, to make changes global, you can set the same in MySQL config files. Depending on your server configuration, make the changes in specific mysqld config files. Make sure the setting is under the [mysqld] group header
[mysqld]
group_concat_max_len=15000
After making the changes, you can Restart the MySQL server.

Related

Copy all data from one database to the other MySQL - MariaDB [duplicate]

This question already has answers here:
Mysql Copy Database from server to server in single command
(3 answers)
Closed 1 year ago.
So I would like to make a test playground for my website where I don't alter with the original production data, and therefore I want to make a copy of all my data, and put it into another database. But how can I do this the right way?
I have a database with a lot of tables called testreporting4, and I want to make a copy of all the data/structure into the database called testreportingdebug
From testreporting4 to testreportingdebug
My database size is around 3.1GB at the moment (don't know if that changes anything)
I think the easiest way is the export the database and then import it. More information regarding exporting/importing MariaDB: https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-in-mysql-or-mariadb

How to disable only_full_group_by? [duplicate]

This question already has answers here:
Disable ONLY_FULL_GROUP_BY
(35 answers)
Closed 2 years ago.
I am facing with problem to disable it. I was looking some explanation step by step,but i can't find. Please anyone can help me about this?
You can reset global variable ##sql_mode - but you need to be careful not removing other parameters that could be part of it.
Here is one approach:
set global sql_mode = (select replace(##sql_mode,'ONLY_FULL_GROUP_BY', ''));
Note that disabling this sql mode is usually an indication of bad design in some of your queries. I would not actually recommend doing this; instead, you should put more effort into writing queries that comply to the SQL standard as regard to group by behavior.

MySQL 8 get the currently used (default) database name [duplicate]

This question already has answers here:
How to determine which database is selected
(5 answers)
Closed 2 years ago.
You may use USE statement
USE <db_name>
to use the named database as the default
but how to get the name of the database that is currently used?
So if USE sets the db name, is there a kind of GET or SELECT statement to read database that was set as the default?
Suppose you get a result of a query after many hours and you forgot what particular database that query was targeting. It would be helpful to be able to ask for the default database name to know which database that query result refers to.
You can just do:
select database()

How to solve case sensitive issue in mysql VIEW [duplicate]

This question already has answers here:
How to change MySQL table names in Linux server to be case insensitive?
(6 answers)
Closed 6 years ago.
My my.cnf config file is with:
lower_case_table_names = 2
so if table name is "MyUsers" it will take as it is.
but in view: i have used as a "myusers".
in windows its working.
Now when i am trying to execute it(view) in linux server then it is saying "myusers" doesnt exists.
what is the problem in linux and its corresponding solution.
Not Duplicate: As I clearly mentioned what I need and what I get. This is in view.
MySQL users files for tables and views. The name of the files are identical to those of the tables as created. Windows is case-insensitive as far as addressing files is concerned. Linux is not, meaning that you can have the files myfile.txt and Myfile.txt at the same folder.
There is no way out (I learned this in the past as you are learning it now). You MUST use table/views names with the same case as they are defined. Column names, on the other hand, are case insensitive.

MySQL Fulltext searching and minimum search term length

I am using fulltext searching in mysql to search a database of videos I have, however when I search my videos some results will never get returned because the title I am searching for is less than the ft_min_word_len set in MySQL's settings.
mysql_query("SELECT MATCH(videoDescription) AGAINST('".$searchString."' IN NATURAL LANGUAGE MODE)
FROM videos
LIMIT ".$start.",".$end."");
I tried firing up the mysql console to change the setting, however it told me it is read only. The only possible solution I have seen is to have the setting overridden at startup with option files. How do I use option files to overwrite the ft_min_word_len to 2 at startup?
ft_min_word_len is a system variable, that has to be set at the startup of the MySQL server.
This can be done passing parameters on the command-line used to start MySQL, or (recommended, I'd say), using a file containing options -- generally, for example, something like /etc/my.cnf or /etc/mysql/my.cnf should do the trick.
For more informations about setting system variables, you can take a look at the following section of the manual :
4.2.3. Specifying Program Options
Also, don't forget that you'll have to rebuild your fulltext index, after changing that parameter, so the new value is taken into account.