Changes to my.ini Not Persisting when using MySQL - mysql

I'm attempting to update some variables for my MySQL database server; I am running Maria version 10.3.12 on a Windows 10 64-bit laptop. I have attempted to update the my.ini file located here:
C:\Program Files\MariaDB 10.3\data\my.ini
I am adding the following lines to a rather simple my.ini
max_allowed_packet=64M
interactive_timeout=86400
wait_timeout=86400
I have saved the changes to the my.ini; but when I restart the database server using mysqld restart at the command console, and then log back into the client, I expect to see my changes using SHOW VARIABLES LIKE 'max%' and what I end up seeing is the default value. The default value for max_allowed_packet is about 16M and for the other two it is 28800.
There are numerous articles that relate to this; having poured over them I am aware of how to use the SET command to update these from within the client. My goal though is to make a permanent change.
I have no doubt I have overlooked something; any feedback is appreciated.

You can identify path of the configuration file by looking into services:
Open services and find MariaDB Service instance
Right click and click on Properties
You should see something like "C:\path\to\exe" --defaults-file="c:\path-to-ini\my.ini"
then you can edit correct configuration file

I found the solution. After making the changes noted in my post I was attempting to restart MySQL daemon using the Windows Command line and the following command:
C:\Users\david>mysqld restart
2019-03-14 21:05:48 0 [Note] mysqld (mysqld 10.3.12-MariaDB) starting as process 8548 ...
The results can be seen below the command which is mysqld restart
MySQL being installed and run as a Service, clearly this was not the was to restart it; so I restarted it using the Services.msc:
Typing Services.msc into the search bar
Selecting Services
In the Services app find MySQL
Right clicking MySQL and selecting
Restart
This caused the my.ini file to be reread.

Related

MAMP MySQL won't start (Windows 10)

I see from reading around this is a very common problem and there are 2 recommended main solutions:
clear the temp files; and
check if another instance of MySQL is running.
Solution 1 - Clear files
I have cleared ib_logfile0, ib_logfil1 and iddata1. When I restart MAMP, it recreates these files but the server does not start.
Solution 2 - Close other instances of MySWL
I am unable to find a way to check if MySQL is already running else where. Reading around (inc MAMP help site), I should use Window task manager to search for "MySQLd" and close any instances that are running, however Win10 seems to have delete the search function from the task manager. A look through the processes did not show any though:
screen shot of windows task manager
Next I have seen people adding "innodb_force_recovery = 1" to my.cnf file. I searched for my.cnf but couldn't find it. Instead I tried adding the line to C:\MAMP\conf\mysql\my.ini and I also tried adding "innodb_force_recovery = 2". Neither worked.
I tried changing the port number that MySQL uses to 3307, that didnt work either.
Finally, I uninstalled and re-installed MAMP - didn't work.
The MySQL error log reads:
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
[Note] C:\MAMP\bin\mysql\bin\mysqld.exe (mysqld 5.7.24-log) starting as process 9044 ...
I think it would be useful if there is a way to check for instances of MySQL running via the command line, and then if they is one, how to close it from the command line.
Following steps fixed my issue
1. Stop your MAMP Server.
2. Find the db folder for mysql. In my case: C:\MAMP\db\mysql
3. Rename the mysql-bin.index file to mysql-bin_old.index
4. Start your MAMP Server
This question has been answered here:
MySQL Server on MAMP-Windows Will Not Start
The fix posted by this user apparently comes from MAMP support. My problem was identical to yours and it worked for me. The issue related to binary logging, which can be disabled in a configuration file.
Good luck.
This is what worked for me :
Click on Start Servers in MAMP
Manually click on mysql.exe in MAMP installation folder
C:\MAMP\bin\mysql\bin\mysql.exe

MySQL Workbench Unable to Retrieve Disk Space in Data Dir, Server Stopped

I had mySQL workbench working fine a few weeks ago. Now, any time I log in, I get no connection. Upon inspecting Sever Status, it is showing Stopped. Also, under the Server Directories, it says Unable to Retrieve next to Disk Space in Data Dir.
I also noticed that the configuration file was wrong, or outdated? The Configuration File originally read:
C:\ProgramData\MySQL\MySQL Server 5.5\my.ini
But I looked and there was no MySQL Server 5.5 file in my directory. I do have a MySQL Server 8.0 folder, so I changed the Configuration File to:
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
However, this fails to solve the problem. I've also attempted to run Services from the Start Menu, right click on MYSQL80, and choose start - and it says the service has Started then stopped.
I'm not even sure this missing or mis-directed file is the issue, or whether it's the Unable to Retrieve Disk error (or both are causing the server to fail). I recently changed my login password for my computer - but I doubt that is related to the login credentials for MySQL, right? (I see MYSQL80 properties has password for 'log on' option, but I have no idea what this password even is, or how to change it).
I've also read about this problem online and cannot seem to find an answer that solves the issue. I've tried running MySQL Workbench as an admin too, and that doesn't work either.
Can anyone point me in the right direction? Is there a way to get the server up and running again without a bunch of complicated command line? I appear to have mysqld.exe in the bin file in MySQL 8.0
Thanks all in advance!
In MySql Workbench Server -> Startup/ShutDown -> Start Server.
This Worked for me.
When the my.ini file is messed up I think the best solution is a total uninstall/delete and manual install. Before you do any of the following make sure you go to your current data dir and save your database folders. Then dlete all of your current MySQL related directories and uninstall MySQL and MySQL workbench.
I had this problem when I installed MySQL 8.0.15 with the community installer. The my.ini file that came with the installer did not work correctly after it had been edited. I did a full manual install by downloading that zip folder. I was able to create my own my.ini file containing only the parameters that I was concerned about and it worked.
download zip file from MySQL website
unpack the folder into C:\program files\MySQL\MySQL8.0
within the MySQL8.0 folder that you unpacked the zip folder into, create a text file and save it as my.ini
include the parameters in that my.ini file that you are concerned about. so something like this(just ensure that there is already a folder created for the datadir or else initialization won't work):
[mysqld]
basedire=C:\program files\MySQL\MySQL8.0
datadir=D:\MySQL\Data
....continue with whatever parameters you want to include
initialize the data directory by running these two commands in the command prompt:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --default-file=C:\program files\MySQL\MySQL8.0\my.ini --initialize
install the MySQL server as a service by running these two commands:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --install --default-file=C:\program files\MySQL\MySQL8.0\my.ini
finally, start the server for the first time by running these two commands:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --console

mysqld.sock missing after server restart; MySQL server fails to start

I manage a local intranet website which runs on Ubuntu. Now, each time I restart the server, the mysqld.sock and mysql.sock files seem to disappear. This causes the MySQL server to not start.
Is this a common problem? Each time, I have to re-install the MySQL server and client to have it appear again.
The mysql.sock file is created when MariaDB starts and is removed when MariaDB is shutdown. It won't exist if MariaDB is not running.
Multiple my.cnf files can conflict. Check to see if you have multiple my.cnf files on your system. Possible locations include:
/etc/mysql/my.cnf (MariaDB default)
/etc/my.cnf
~/.my.cnf
Try to re-initialize your data directory 'offline' using mysql_install_db.
For me the case was that an OS update turned /var/run/ into temporary directory that was cleared on every restart.
Solution was to enforce recreating of /var/run/mysqld on every startup using one of the two methods described here: https://askubuntu.com/a/306479/567859

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.

Mysql service wont start on windows 2008 server r1

About a month ago, after I changed a startup parameter on mysql administrator, my server got frozen. So I rebooted. Ever since my mysql service wont start on startup or when I try to start it manually. I can only start mysql in console mode (mysqld --console).
I have tried many things but none of them worked:
I have uninstalled and rebooted the server and then installed again;
I have deleted everything in program files folder related to mysql and installed again
I have deleted all the related files in programdata folder
I have treid to use 3307 port instead of 3306 but still not worked
Now when I install mysql again it can never manage to start the service during the setup procccess, so it never manages to end of installation. But I can still start the mysql server on command line with "mysqld --console"
I tried to look into the event lgo , the only error I see is plugin federated is disabled, I looked for solutitions about this error but none worked for me. I believe this might be something abput windows. Any help appreciated.
Uninstall, delete and all the cleanup you did above.
Additionaly manually delete MySQL Windows service.
This can be done by command line using sc stop MySQL then sc delete MySQL.
Before installing, a reboot shouldn't be necessary.
Recreating the Windows service manually, if the installer doesn't do it for you, can be done using "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install (as the manual says).
If the MySQL installer has installed the service with on demand start-up type, you can edit to start automatically at boot using: sc config MySQL start= auto (the white space after the = sign is intentional and needed). Afterwards you can start the service using sc start MySQL.