MySQL binary log location Windows 2008 Server - mysql

I'm running a Windows 2008 Server with IIS, PHP and MySQL. MySQL is installed as a service. There's software on the server that uses a database that I need good backups of, including transaction logging. I've turned on Binary Logging via setting log-bin= and expire_logs_days= in the my.ini file. This saves those logs in the MySQL data folder on that drive. If I lose the drive, I lose my logs and they've done me no good as a backup.
I've found all kinds of advice for relocating these logs on a Linux box, but trying to use the same idea of including a path in the log-bin statement is not working. I've tried "flipping" the slashes, adding quotes and the common other attempts when "translating" Linux to Windows.
I created a mapped drive to the external location to make this easier, and I've tried using \server\folder path statements as well as z:\ path statements.
Any help would be greatly appreciated.

If you made your changes in the [mysqld] section in the my.ini file then you should be good. The correct path naming convention, should look something like this log-bin="C:/yourfilepathname/logs". Since you are still experiencing issues, Please check to make sure that mysql has permission to write to the directory that you are specify the logs files to be written to.
Another way you can check if this is the issue, go to your .err log file when you try to stop and start mysql server it will tell you something along the lines of not having permission to write to that directory.
Also, I would note that log bin files in it of themselves are not a backup. You need to be taking mysqldumps or snapshots of the entire directory from your server, preferably from a slave of your master production server.

You are missing a trailing slash.
Here is what's in my my.ini (I'm using MariaDB 10.1, but I believe this will work for you also):
[mysqld]
datadir=D:/mysql-data
log-bin=E:/mysql-bin/
When I left out the trailing slash in the log-bin setting, I also got the same error in logs, and the service failed to start. After adding the slash, no errors, and the service started successfully.
I now see files getting created in E:\mysql-bin, such as .index, .000001.

make sure you are ending with filename. see below.
log-bin=C:/Program Files/MySQL/MySQL Server 5.6/data/bin.log

Actually it's due to using the normal windows backslashes. Instead of z:\ use z:/ (forward slash). Also if you don't end with a forward slash then it will use the last part as the file name. Exp:
z:/bin-logs/ (this will have files named .index and .000001)
z:/bin-logs/log (this will have files named log.index and log.000001)

Related

MySQL80 Service on local computer started and the stopped. How to solve?

I'm receiving this error of MYSQL80 service on local computer started and stopped. Some services stop automatically if they are not in use by other services or programs. when I try to start my MySQL server from the services.msc
I already run mysqld --install and mysqld --initialize. Already tried to change the properties of the service to local system account. I checked my.ini file, it is in Program Data folder, the Uploads folder exists as well. I also checked the .err file but nothing is helpful there, the last line is something like 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. that I don't really know what it means and google didn't help.
I don't know what else to try, I tried pretty much everything that I found.
This is my path to executable, do you think this should point to my.ini file? If so, how do I change that?
Also, there is another MySQL service on the list which I can start, but it's empty, my database is on the MySQL80 server (the one that I cannot start):
Any idea?
I am assuming that the password you enter is valid and still it's showing a login error.
I had the same issue just to allow the table to CSV export. I made some changes in my.ini and the service mysql80 never started.. after searching everywhere I came to the conclusion that we need to uninstall the MySQL server (Just server) and reinstall it.
Don't worry your databases will be safe just uninstall MySQL server "Control Panel\All Control Panel Items\Programs and Features" and reinstall MySQL server. MySQL installer-> add->mysql server 8.X.X, and try login again.
Hope this help just worked like magic for me.
If using version 8 and you edit the my.ini I found that Notepad is putting 3 hex characters at the beginning of the my.ini file. EF BB BF. Deleting the 3 characters from the beginning of the file in a hex editor fixes the problem.
In version 8 they are accidentally putting Unicode characters in the ini file. This is causing Notepad to save the file with Byte order mark characters.
The following line in the file is the culprit "The line # range from 1 to 2^32 − 1. “Unique” means that each ID must be different." has 3 Unicode characters. This is causing notepad to append the byte order mark to the text file.
The other solution is to replace the my.ini file if you have a backup.
Stop the service mysql and start the services mysql80.
That's what I did and worked.

Raspberry Pi MySQL Remote Connection (error: 10061)

I'm trying to connect to a MySQL server running on my Raspberry Pi 3 remotely (though on the same LAN).
Attempting to do so through HeidiSQL returns an error coded 10061. A bit of research suggests I have to edit the config to allow remote connections.
The config, however, does not contain a bind-adress x.x.x.x line (/etc/mysql/my.cnf) for my to comment out. Added it myself breaks the service, causing errors when trying to restart it.
Checking other possible config file locations resulted in only empty files.
Additionally, comparing to the "default" config file, mine is a lot shorter, and has no actual statements, other than a few includes for other config files (it seems). These included files are all empty as well.
I'm now lost, and cannot figure out how to allow remote connections to my server. Any help is much appreciated :)
Thanks to #PetervanderWal, I suspected that the lack of a bind-address statement in the config was no freak coincidence. Therefore, I did a grep search for any files containing "bind-address", and found the correct configuration file: /etc/mysql/mariadb.conf.d/50-server.cnf. This file had the ´bind-address´ statement, which - after commenting it out - fixed the problem.
The takeaway here (if you ask me) is, if none of your config files contain the bind-address statement, widen your search for the correct config file.
Thanks Peter, hope this helps others.

MySQL 8.0 Deployment with Data Seperate

I have been running MySQL 5.X for several years. Just come to a new server and downloaded V8.0.11.0. I installed it and it asked me no questions about where to keep the data, it has put it all on the C: drive. I want to keep it separate to make backup easier. How do I make the data location move to another disk?
What I have tried:
The old 5.7 method of stopping the server, moving the files, updating
my.ini and restarting. You can't move the files (Access denied) and
the server doesn't start if you change the my.ini file.
mysqld --initialise --datadir="F:\MySQL\Data" (tried forward slashes and double slashes as well)
I can't find any documentation! It's a pretty basic requirement so I'm guessing it must be documented!
OK, I uninstalled MySQL and then ran the installer again. The first question is where do you want to put things! I take it all back, apologies for missing it!

MySQL Master-Slave replication on Windows, when put server-id=1 on master it's not starting

I am trying to get Master to Slave replication on my MySQL server, but after put in server-id=1 in the my.conf and stop the mysql server and then start it again from Services in windows it's getting error and could not start.
Problem is that i can not find a real error message, the only one i get is from windows that could not start the service.
Do anyone have any ideas?
If you have trouble starting the MySQL service, check its error log. On Windows, it's probably located in C:\Program Files\MySQL\MySQL Server x.y.z\data\computername.err (where computername is the name of your Windows server).
A couple of ideas: try spelling the config variable "server_id" with an underscore instead of a dash. They are supposed to be interchangeable, but I have seen cases where they aren't for specific variables.
Search the config file to see if you have another line declaring a different server-id.
Did you make any other changes to the config file at the same time? If so, it could be that the server-id change is fine, but another change resulted in an error. Undo those changes and make them one at a time, restarting the MySQL service each time.

changing default my.cnf path in mysql

I am having two mysql instances on same machine. The installations are on /usr/loca/mysql1 and /usr/local/mysql2.
I m having separate my.cnf files located in /etc/mysql1 and /etc/mysql2. I installed the first instance of my sql using source distribution and with the --prefix=/usr/local/mysql1 option. The second one i got from copying and pastinf the same directory to /usr/local/mysql2.
When i start the mysql daemon on /usr.local/mysql/libexec it reads the my.cnf file in /etc/mysql1. And if i start the mysql daemon in /usr/local/mysql2 it reads the same my.cnf file. I have separate port numbers and .sock files defined in the .cnf file in those 2 locations.
I can read the my.cnf file in the second location by using --defaults-file=/etc/mysql2/my.cnf option on mysqld startup. I do not need to enter this each and every time i start the daemon.
If i am going to have more instances how can i point the correct my.cnf file to read to each and every mysql daemon. What is the retionale behind mysqld links with the my.cnf file.
how can i predefine the location of my.cnf file for each instance.
As you've already discovered, MySQL has a compiled-in search location for its configuration file. Although you could recompile yourself, changing this, you've also discovered the --defaults-file option to mysqld, which instructs it to use an entirely different configuration path. Coupled with --data-dir, this means you can start multiple instances of MySQL bound to different ports (and addresses, if liked) and working with entirely separate sets of data, while working off the same binaries and libraries.
Traditionally, most operating system distributions will bundle a single init script for starting the "default" instance of MySQL; that is, the one installed in the "usual" location, and with the standard configuration path. Although this is to cater for the commonest case, what you're after is a bit different, so you'll need to create separate scripts to launch the separate instances.
If you're planning on deploying a lot of MySQL instances on the same machine (and I'd have to ask why), then you may want to write a custom init script which has some way of "discovering" each of these (perhaps by inspecting some directory containing a "common" layout), and then loops over them, starting each one up. Of course, the same init script then needs to be capable of locating and properly shutting down each one.
I think the only sure way is to compile from source with the prefix option. Either that, or create a bash script that starts mysql2 with the --defaults-file option and then use that to start it instead.
However, "creating" another installation the way you did isn't good. When you compile a package, the PREFIX is hard-coded into the executable. So whenever it looks for a resource, it starts from that prefix, unless told not to with command line options.
So, if I were you, I'd just recompile from source with a new prefix.