I am getting this error when i run mysql -uroot after installing mysql through brew install mysql
mysql: [ERROR] Found option without preceding group in config file /etc/my.cnf at line 1.
mysql: [ERROR] Fatal error in defaults handling. Program aborted!
My "my.cnf" looks like this:
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
I tried every solution online and nothing worked.
I've added [mysqld] in front of the file.
I've moved the commented lines.
I've completely uninstalled mysql using the steps here: https://gist.github.com/vitorbritto/0555879fe4414d18569d and reinstalled it.
I also tried changing the encoding of my my.cnf file from binary to ASCII but it did not change after i run this:
file -I /etc/my.cnf
/etc/my.cnf: application/x-mach-binary; charset=binary
Maybe that's the issue i'm not sure.
Any modification I try, I keep getting the same error mentioned above.
I'm running on a macOS, Big Sur, version 11.6
Please do help.
I am importing dump file in mariadb on windows . It show me "Mysql server has gone away" error . I knew the solution that add
max_allowed_packet=500M
in my.cnf but issue is that is have seen five init files in that directory
C:\Program Files\MariaDB 5.5
my-huge.ini
my-innodb-heavy-4G.ini
my-large.ini
my-medium.ini
my-small.ini
so in which file i change "max_allowed_packet=500M" .Please suggest to me how i change the configuration of mariadb on windows for this issue.
I have face same problem because configuration file did not work for me,so you have to pass max_allowed_packet value directly in a query.
mysql -u username -p --max_allowed_packet=1073741824 < dump.sql
None of these .ini files are used by your server, with default installation. Those are examples.
my.ini in the data directory is used, which in default installation is in
C:\Program Files\MariaDB 5.5\data
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'm trying to dump a large database (126 MB) with extended inserts in MAMP (localhost on my computer) and I get errors whatever I do.
First I tried to dump it via terminal with
/applications/MAMP/library/bin/mysql -u root -p databasename < /path/file.sql
but I got this error (line 44 is where there is the first INSERT INTO)
ERROR 2006 (HY000) at line 44: MySQL server has gone away
so I copied my-large.cnf into /applications/MAMP/conf/ renamed it to my.conf, set the new values for max_allowed_packet
[mysqldump]
quick
max_allowed_packet = 32M
and also put the line skip-character-set-client-handshake after [mysqld]
# The MySQL server
[mysqld]
skip-character-set-client-handshake
saved the file, restarted the server, tried again to dump the database with the command line and still got the same error.
I also tried to import it with MY MAMP DUMP but I get an error message after few seconds: An error occurred while processing SQL file.
I then tried with bigdump, where I set $max_query_lines = 6000; but the script doesn't even seem to run (yes, I put the file and the script in the same directory and yes, the mysql server is running).
I really don't know what else to do, what could be the problem?
I want to change max_allowed_packet on server using WHM vps.
but I am not getting at where it located, so please help me
I have tried
SET GLOBAL max_allowed_packet =1073741824;
but its not working its required super admin.
how to edit mysql.ini in WHM vps
same with httpd.conf, how to edit setting of apache in WHM ?
Ahoy,
You can not edit the servers my.cnf file from inside WHM, you will need to edit this file using she ssh command line. To learn how to connect to your server using ssh please see:
http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/ShellAccess
Once you are connected to your server with the root login using ssh, you will want to issue the following command to edit my.cnf:
# nano -w /etc/my.cnf
In this file you will want to add a line under the [mysqld] section with the following contents:
max_allowed_packet=500M
You will now want to press Ctrl + O to save, and then Ctrl + X to exit. You will now want to restart the MySQL server through WHM or on the command line with:
# /etc/init.d/mysql restart
This will update the max_allowed_packet for cPanel/WHM's mysql.
Change in the my.ini/my.cnf file. Include the single line under [mysqld] in your file
max_allowed_packet=500M
now restart the MySQL service once you are done. You can see it's current value in mysql like this:
SHOW VARIABLES LIKE 'max_allowed_packet'
You can read about it here http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html