Mariadb Error : Mysql server has gone away [import dump] - mysql

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

Related

After install, mySQL doesn' start (windows10, source install)

I'm installing Apache server, php, and MySQL on Windows10.
First two was successful but MySQL has a problem.
I installed MySQL into C:\mysql-5.7.10-winx64, and changed my.ini like this
basedir = C:/mysql-5.7.10-winx64
datadir = C:/mysql-5.7.10-winx64/data
port = 3306
I succeeded install but if I try to start, it shows like below
C:\Windows\system32>net start mysql
The MySQL service is starting.
The MySQL service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
However, if I check Computer Management>Event Viewer>Custom Views>Summary page events, it tells me "failed to set datadir to C:\mysql-5.7.10-winx64\data\"
If I make data folder manually, error message changed to
Can't open the mysql.plugin table
Please run mysql_upgrade to create it.." and some files are created in data folder
I tried to upgrade by typing mysql_upgrade but it failed.
mysql_upgrade: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server. Upgrade process encountered error and will not continue.
How can I solve this issue?
Clear the "data" directory, then run command mysqld --initialize, and the command net start mysql, bingo!
1.For the error,
2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server. Upgrade process encountered error and will not continue.
I ran the cmd as administrator and then go to \Program Files\MySQL\MySQL Server 5.7\bin\, and run
mysqld install
2.For the error,
C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql
The MySQL service is starting.
The MySQL service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
Try
mysqld --initialize
and then
net start mysql
Thanks to Athan's answer. Those combination worked for me.
I also had the same problem and I wasted hours solving the issue, but in the end this worked.
Go to you C:\ProgramData\MySQL\MySQL Server 5.7 and copy the my.ini file from there.
Go to C:\Program Files\MySQL\MySQL Server 5.7 and paste it there.
Open cmd and run net start mysql
It would work like a charm.
Explanation:
MySQL couldn't find my.ini, therefore tried to create data in Program Files... where it had no rights to do so, therefore it says access denied every time you run it.
This is old but I was running into the same problem you were seeing. I thought I'd share this answer for anyone looking. I created the data directory as you did initially and tried to start the service and got "Can't open and lock privilege tables: Table mysql.user doesn't exist." I then deleted the contents of the data directory and instead initialized the data directory by running the following command from the bin folder.
mysqld --initialize [with random root password]
mysqld --initialize-insecure [without random root password]
I had the same error, after checked this document: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization.html
I just clear data directory and add the --console option to initialize:
bin\mysqld --defaults-file=C:\my.ini
--initialize --console
Hope this help
MySQL Server can either be run as a Program or as a Service. You cannot run both. You should stop 'mysqld' Server Program before starting 'mysqld' Server as Service.
The 'mysqld' Server Program can be stopped either by typing
'CTRL + c' or by issuing
'mysqladmin -u root -p shutdown' command and issue the password when prompted.
You need download from https://dev.mysql.com/downloads/mysql/ previous GA versions, and after that copy directory "data" to your new mysql or outher directory what you write in configfile my.ini in directory mysql-"version" .
For your error, main cause is in your my.ini setting.
Since you are installing MySQL on Windows, you should define path like:
basedir = C:\\mysql-5.7.10-winx64
datadir = C:\\mysql-5.7.10-winx64\\data
These slashes must be doubled.
Then start your MySQL service again. I guess this time would work.
And here is official document from MySQL.
This saved my life,
Just turn off the windows firewall and Give he port number correctly as 3306 as default, then restart MYSQL server . After that turn on the windows defender firewall
Just work it fine.
Looks like my solution is not added yet,
I've installed mysql80 , edited my.ini in windows notepad and got the same error like topic author "... NET HELPMSG 3534." when I start mysql service,
and my issue was in extra bytes added by notepad at the begining (EB BB BF) on my.ini, when I edited (added the same changes) my.ini in other editor everything worked fine.

How to change the default port of mysql from 3306 to 3360

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

MySQL Dump Not Working In MySQL

I just installed a new Windows 7 Professional machine with MySQL 5.6.22. When trying to run the mysqldump command, I get the following:
E:>mysqldump -u root -p world > world.sql
mysqldump: unknown option '--no-beep'
Mysqldump works fine on my other machines running 5.16.15 and 5.5.xx.
Unfortunately, the msi installer for MySQL 5.6.15 will not work as some packages cannot be found. Oracle, it seems, will not support previous editions of 5.6.
On top of that, the MySQL installer for 5.6.23 only installs 5.6.22 in a round about way. The MSI installer has issues.
Can anyone shed light on mysqldump not working in 5.6.22?
Thanks!
I think you need to run the mysqldump command from the path it is installed, first cd into the folder and then run the command like this
C:\MySQL\MySQL Server 5.6\bin>mysqldump -u root -p -B database>name_of_backup_file.sql
I had the same issue. Search your active my.ini for the [client] section. Likely you will find the following:
[client]
no-beep
Comment or delete no-beep. It solves the 'no-beep' issue (now I have a new annoying error, hooray!). Be carefully checking whats your active my.ini because you might have some on different places.
Edit: Now, as I can call mysqldump w/o error, option --help tells me the follwing:
Default options are read from the following files in the given order:
C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf [Your Server DIR]\my.ini [Your Server DIR]\my.cnf

mysqldump windows unknown option '--no beep'

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.

MySQl Configuration Error After reinstall it

When I reinstall MySQL database after uninstall it, I got this error when configuration:
Error 1045
Now, My new directory is here:
E:\Program Files (x86)\MySQL\MySQL Server 5.5
and my old directory was this:
c:\Program Files (x86)\MySQL\MySQL Server 5.5
I delete whole MySQl folder on drive c , But it has error when want to config!
How can i fix this problem?
Thanks is advance.
You can follow this method as well:
Menu>Start>Run>CMD
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld.exe" --skip-grant-tables
Let's this window open and open a new one
Menu>Start>Run>CMD
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe" -u root
You're now connect to MySQL, you have to modified the root account in the date of MySQL
mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD('motdepasse') WHERE user="root";
mysql> flush privileges;
mysql> exit;
Restart with MySQL Command Line Client
That's it
You should delete the data directory and then retry to install it, it should be in:
C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\data
As mentioned on the last paragraph of your screenshot:
If you are re-installing after you just uninstalled the MySQL server please note that the data directory was not removed automatically. Therefore the old password from your last installation is still needed to connect to the server. In this case please select skip now and re-run the Configuration Window from the start menu.
Your solution:
1. "Add or Remove Programs
2. Deleted c:\mysql
3. Rebooted the PC
4. Reinstalled MySQL