I am a linux beginner, especially ubuntu. I want to manage the mysql database installed on my Ubuntu web server by using Putty. But the MySQL syntax that I run always fails. Example syntax:
mysql -u root -p
All failed messages are the same for any syntax:
mysql: unknown variable 'bind-address = 0.0.0.0'
I don't know whether to run the Mysql syntax on Ubuntu I need to go to a certain Folder/Path, like in windows if I want to run the mysql syntax I need to go to the path where MySql is installed, for example C:/xampp/mysql/bin and then run the syntax mysql -u root -p.
is there anything I miss? and what should i do? please help, thank you.
Option 1: A typo in a title
Have a look in your my.cnf file.
Maybe you have a typo: There should be [mysqld] instead of [mysql] section
[mysqld] bind-address=0.0.0.0
OR
[mysqld]
bind-address=0.0.0.0
Source
Option 2: Is it Maria DB?
Are you sure you are using MySQL ?
This looks like a MariaDB error.
Try to remove the bind-address from your mysql.cnf file.
Option 3: Check for any whites-pace?
Try editing the file and using show all characters in your editor (e.g. Notepad Plus Plus). Maybe there are whitespace characters ( such as spaces ) causing problems.
Related
Since MySQL 8 the column-statistics flag is enabled by default.
So if you try to dump some tables with MySQL Workbench 8.0.12, you get this error message:
14:50:22 Dumping db (table_name)
Running: mysqldump.exe --defaults-file="c:\users\username\appdata\local\temp\tmpvu0mxn.cnf" --user=db_user --host=db_host --protocol=tcp --port=1337 --default-character-set=utf8 --skip-triggers "db_name" "table_name"
mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'db_name' AND TABLE_NAME = 'table_name';': Unknown table 'COLUMN_STATISTICS' in information_schema (1109)
Operation failed with exitcode 2
14:50:24 Export of C:\path\to\my\dump has finished with 1 errors
Is there any way in MySQL (Workbench) 8 to disable column-statistics permanently?
Workaround 1
An annoying workaround is doing it by hand via:
mysqldump --column-statistics=0 --host=...
Workaround 2
rename mysqldump
create a shell script (or batch on Windows)
call the renamed mysqldump with the --column-statistics=0 argument within this script
save it as mysqldump
Workaround 3
download MySQL 5.7
extract mysqldump
use this mysqldump
For example in MySQL Workbench: Edit / Preferences... / Administration / Path to mysqldump Tool
Thanks in advance!
Workaround for me:
Create file named mysqldump.cmd with contents:
#echo off
"c:\Program Files\MySQL\MySQL Workbench 8.0 CE\mysqldump.exe" %* --column-statistics=0
(replace path to mysqldump.exe if necessary)
Open MySQL Workbench and go to Edit > Preferences > Administration, change path to mysqldump tool and point it to mysqldump.cmd
Easiest Work Around
When using Mysql Workbench 8.0
Open the "Data Export" Tab
Click Advanced Options
Under the Other heading, set column statistics to 0
Export again
Best of luck!
I have download the version 8.0.16, still the same issue.
At data export advanced options I didn't saw any option about "statistics"!
I have add at my.ini at
[mysqldump]
quick
max_allowed_packet = 16M
column-statistics=0
Doesn't solve the issue
I have been googling but I couldn't find the solution. I find a of companions who are strugling with this but not anyone with the solution at least for me.
At the end I have changed at MySQL Workbench file c:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py:
skip_column_statistics = True #if get_mysqldump_version() > Version(8, 0, 2) and self.owner.ctrl_be.target_version < Version(8, 0, 0) else False
I have made comment of
if get_mysqldump...
I know this is not the way, but I can't find now another better solution. For me is this at least weird and strange. If anyone has a better solution let me know!
P.S. Restart Workbench after change has been made
The idea is this: each server version has a dedicated mysqldump version. Not ideal and certainly not very backwards compatible, but that's the situation. MySQL Workbench can only include one mysqldump binary, so the latest one is used. The approach to download the MySQL 5.7 zip and use mysqldump from there is a good workaround without many side effects. You only have to be careful which server you dump with which dump version.
If you like to have that column stat flag automatically applied by MySQL Workbench please file a bug report at https://bugs.mysql.com.
Update
Meanwhile a bug report has been created for this issue: https://bugs.mysql.com/bug.php?id=91640
WINDOWS USERS
I have MySQL Workbench 8.0CE and Xampp v3.2.3 and this worked for me:
Open xampp, and open mysql config > my.ini // add: column-statistics = 0 so:
[mysqldump]
quick
max_allowed_packet = 16M
column-statistics = 0
Save and close, reboot xampp mysql server. (just in case)
in Workbench:
Edit > Preferences > Administration
In Mysqldump route put your mysqldump route of xampp, in my case:
C:\xampp\mysql\bin\mysqldump.exe
This worked for me!
There may be another workaround if you are running an OS that supports mysqldump (i.e. Linux). Set the path to the mysqldump binary in the preferences and include the --column-statistics=0 argument in the path, in:
Edit >> Preferences >> Administration >> path to MysqlDump Tool
From Mysql-workbench version 8.0.14 you don't have the option to disable column-statistics.
But you have an option to do it by enabling delete-master-logs:
https://stackoverflow.com/a/64855306/10747412
Download the last version of Mysql Workbench 8.0.16 and no more problems.
https://dev.mysql.com/downloads/workbench/
No option to check !
Open MySQL Workbench Preferences and choose Path to mysqldump Tool accordiing to your xampp / mysql server path
MySQL Workbench Edit > Preferences > Administration
C:\xampp\mysql\bin\mysqldump.exe
that's it
I am using Ubuntu 16.04, MySql Workbench 6.3.6, MySql 8.0.25, MySqlDump 8.0.25.
My workaround is as follows:
Open /usr/lib/mysql-workbench/modules/wb_admin_export.py
Replace
s = re.match(".*Distrib ([\d.a-z]+).*", output)
with
s = re.match(".*mysqldump Ver ([\d.]+).*", output)
Replace
cmd = subprocess.list2cmdline(args)
with
args.append("--column-statistics=0")
cmd = subprocess.list2cmdline(args)
Linux users
Same idea as the other answer above on Windows, here is a way to globally change the mysql settings on Linux so that you do not need to write mysqldump --column-statistics=0 anymore.
Quote from Server Fault Stack Exchange at mysqldump throws: Unknown table 'COLUMN_STATISTICS' in information_schema (1109), highly upvoted there:
To disable column statistics by default, you can add
[mysqldump]
column-statistics=0
to a MySQL config file. Go to /etc/my.cnf, ~/.my.cnf, or directly
to /etc/mysql/mysql.cnf.
I recommend changing it directly in the /etc/mysql/mysql.cnf.
I fixed this by amending the MySQL Workbench config file wb_admin_export.py.
See my answer here.
[![Export From DBEAVER with extra command][1]][1]
For me, I just added an extra command and it worked for me!
[1]: https://i.stack.imgur.com/9iBvO.png
Mac user:
/Applications/MySQLWorkbench.app/Contents/Resources/plugins
Update file wb_admin_export.py to skip_column_statistics in all cases.
skip_column_statistics = True # if get_mysqldump_version() > Version(8, 0, 2) and self.owner.ctrl_be.target_version < Version(8, 0, 0) else False
So I'm on my website setting up a new database for a user dashboard an I run into this problem:
This is a MySQL Server. I set it up as MySQLI as MySQL Would not seem to work
Columns was added
Any tips on how to solve this? I had looked at all my tables but I don't know what it could be.
Located at /etc/mysql/ directory in a standard installation.
sudo vim /etc/mysql/my.cnf
Then add the following lines to the end of its content (you need to press “insert” key before typing in “vim”)
[mysqld]
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
then save the file. (press “Esc” and then type “:wq” in “vim” to save and exit)
Once done restart the MySQL server by running
sudo service mysql restart
I want to change the default port number of MySQL server presently it is 3306. I want to change it to 3360.
I have tried:
-- port=3360
But things are not working for me. Please provide query to change port not any configuration. I am using Windows 8 64 bit.
You need to edit your my.cnf file and make sure you have the port set as in the following line:
port = 3360
Then restart your MySQL service and you should be good to go. There is no query you can run to make this change because the port is not a dynamic variable (q.v. here for MySQL documentation showing a table of all system variables).
If you're on Windows, you may find the config file my.ini it in this directory
C:\ProgramData\MySQL\MySQL Server 5.7\
You open this file in a text editor and look for this section:
# The TCP/IP Port the MySQL Server will listen on
port=3306
Then you change the number of the port, save the file.
Find the service MYSQL57 under Task Manager > Services and restart it.
On newer (for example 8.0.0) the simplest solution is (good choice for a scripted start-up for example):
mysqld --port=23306
When server first starts the my.ini may not be created where everyone has stated. I was able to find mine in C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.6
This location has the defaults for every setting.
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
# pipe
# socket=0.0
port=4306 !!!!!!!!!!!!!!!!!!!Change this!!!!!!!!!!!!!!!!!
[mysql]
no-beep
default-character-set=utf8
Go to installed mysql path and find bin folder,open my.ini and search 3306 after that change 3306 to 3360
Actually, you can just run the service using /mysqld --PORT 1234, it would force mysql to run on the specified port without change the cnf/ini file.
I just cought a case that cnf didn't work. It was weired... so I just use the cmd line as the shortcut and it works!
try changing the connection port to 8012
open xampp as administrator
Mysql config => my.ini change the port from 3306 to 8012
close and run it again
I hope it will work.
If you are using windows and installed the database as a service, which is the default, you should find your configuration file by opening your services management console.
For instance: win + r and then type services.msc
Look for a service called MySQL or MariaDB.
On the general tab of the properties of this service you can find a path to your mysqld.exe file and the arguments to start the exe. The --defaults-file argument should point to your configuration file.
Edit your configuration file and restart the MySQL service.
In Windows 8.1 x64 bit os, Currently I am using MySQL version :
Server version: 5.7.11-log MySQL Community Server (GPL)
For changing your MySQL port number, Go to installation directory, my installation directory is :
C:\Program Files\MySQL\MySQL Server 5.7
open the my-default.ini Configuration Setting file in any text editor.
search the line in the configuration file.
# port = .....
replace it with :
port=<my_new_port_number>
like my self changed to :
port=15800
To apply the changes don't forget to immediate either restart the MySQL Server or your OS.
Hope this would help many one.
Change my.cnf file and add this line or change it port=3360
at my fedora 34
sudo vi /etc/my.cnf
add This line ==> port=3360
The best way to do this is take backup of required database and reconfigure the server.
Creating A Backup
The mysqldump command is used to create textfile “dumps” of databases managed by MySQL. These dumps are just files with all the SQL commands needed to recreate the database from scratch. The process is quick and easy.
If you want to back up a single database, you merely create the dump and send the output into a file, like so:
mysqldump database_name > database_name.sql
Multiple databases can be backed up at the same time:
mysqldump --databases database_one database_two > two_databases.sql
In the code above, database_one is the name of the first database to be backed up, and database_two is the name of the second.
It is also simple to back up all of the databases on a server:
mysqldump --all-databases > all_databases.sql
After taking the backup, remove mysql and reinstall it. After reinstalling with the desired port number.
Restoring a Backup
Since the dump files are just SQL commands, you can restore the database backup by telling mysql to run the commands in it and put the data into the proper database.
mysql database_name < database_name.sql
In the code above, database_name is the name of the database you want to restore, and database_name.sql is the name of the backup file to be restored..
If you are trying to restore a single database from dump of all the databases, you have to let mysql know like this:
mysql --one-database database_name < all_databases.sql
I am having a problem with the mysqldump command in general (import/export).
I write in windows command window the following:
C:\MySQL\MySQL Server 5.6\bin> mysqldump -u root -p nameofdabase> C:\temp\dumpfile.sql
and i get "mysqldump unknown option --no beep". It doesn't ask me for my password and it doesn't seem to recognize the mysqldump command even though I see it in the bin directory. What am I doing wrong??I have tried everything from changing paths to changing backslashes. Anything I have found online that seems to work keeps giving me the same kind of error.
Any clues will be much appreciated...Thank you all in advance
You probably have a line in my my.ini (or my.cnf) file that says "no-beep". This is an option for the mysql client, but not for mysqldump.
If you want the "no-beep" option for the mysql client only, edit your my.ini file and move it under the file section heading [mysql].
See also mysqldump unknown option no beep
There is a "default" my.ini here: C:\ProgramData\MySQL\MySQL Server 5.7\my.ini.
It contains the no-beep option.
The MySQL Installer has my.ini templates for various versions in C:\ProgramData\MySQL\MySQL Installer for Windows\Manifest\Templates\, for some reason, all of it contains this option.
I'm on Ubuntu 11.04. Everything works PHP, PHPMYADMIN, manual login to MySQL etc.
I have written a C application that uses MySQL. Now, when I start this application I receive the above error. I tried to prevent that from happening by linking the original file into the /tmp/ folder (ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock), however, after a while I start getting this error again - because my link has been removed, which is frustating.
What do I need to do to make this work?
The MySQL libraries are compiled with a default of /tmp/mysql.sock. The server is started up with /var/run/mysqld/mysql.sock and your $HOME/.my.cnf does not reflect this value in the [client] section.
If this is run without a valid $HOME you may need to use mysql_options with MYSQL_READ_DEFAULT_FILE.
Try linking the file in other location than /tmp/ and use it from there