I have a problem with Event Scheduler. It is disabled automatically when I restart the MySQL Server. How can I enable the event scheduler automatically when I restart the MySQL Server.
I have red one solution after a long search, i.e enable the Event Scheduler in my.ini file in MySQL with the following command.
event_scheduler=on
If I make changes in my.ini file with the above command it displays an error while saves the my.ini file like 'access denied'.
Is there any problem in my above process? If there is, any solution for this problem?
Thanks in advance.
It is a problem with your privileges in windows and not with mysql, just open the file with notepad which runs with administrator privileges. Right click notepad and chose "run as administrator", then open your my.ini file and edit it.
You can set
SET GLOBAL event_scheduler = ON;
(or)
SET GLOBAL event_scheduler = 1; // in my.ini or my.cnf file.
Then restart your server for the setting to take effect.
Once set 'event_scheduler' will always remain 'ON' no matter whenever your server restarts
Related
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.
I am trying to set my Mysql mode using this. It works, but when the server is restarted it defaults back to STRICT_TRANS_TABLE, NO_ENGINE_SUBSTITUTION. How can I make it permanent so it stays this way after a restart.
set global sql_mode="NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLE,
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Alter your mysql configuration file. The file is called my.cnf if in windowzzz look for the my.ini
Append the following line to it and restart your mysql engine after
sql-mode="NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLE,NO_AUTO_CREATE_USER,
NO_ENGINE_SUBSTITUTION"
Say I have installed MySQL workbench on windows 7 without a server, and I'm connecting to a remote server.
How can I set client configuration (like the [client] section in 'my.ini') for the workbench?
Or maybe I get it the wrong way and the client loads the configuration from the server that it connects to?
Update:
Maybe I wasn't clear enough. The configuration I'm trying to set is command lines to run at the beginning of each transaction, such as:
SET autocommit=0;
SET tx_isolation='READ-COMMITTED';
If MySQL server is installed on my machine, then I can add the following lines to the 'my.ini' file in the installation folder:
[client]
init-command="SET autocommit=0; SET tx_isolation='READ-COMMITTED'"
You asked this a long time ago, and so maybe this is no longer relevant to you, but I will include a way of doing this here to benefit others.
In Workbench open your connection properties.
On the Connection Tab, select the Advanced Tab.
In there add the following two options to the Others section (obviously change the readDefaultFile location to the location of your my.ini).
readDefaultFile=C:\Program Files\MySQL\MySQL Server 5.7\my.ini
readDefaultGroup=client
Now opening connections should read the client section from that my.ini as required.
MySQL Workbench doesn't load any server configuration file for its own configuration. It can work on such a config file for a server, however (server section, usually [mysqld] only).
MySQL Workbench's configuration is a manual step you have to do in order to connect to a server (be it local or remote).
I did the following,
mysqld.exe --defaults-file="D:\my-large.ini"
I changed the max_allowed_packets inside of that .ini but I'm still receiving the error. How do I know that MySQL loaded that file?
You can check max_allowed_packets from the mysql prompt like so:
show variables like '%max_allowed%';
What worked for me was
1. start Mysql workbench 5.6
2. In the navigator go to Instance options file.
3. Click the networking
4. Enter 16M in the max_allowed_packet edit box, click apply and restart mysql
5. Show variables like 'max_allowed_packet' will now give 16777216
I would like to change the database files location of MySQL administrator to another drive of my computer. (I run Windows XP SP2 and MySQL Administrator 1.2.8.)
--Under the startup variable --> General Parameters --> I changed Data directory: from C:/Program Files/MySQL/MySQL Server 5.0/data to D:/....., but after I stopped the service and restarted it, the following error appeared:
Could not re-connect to the MySQL Server.
Server could not be started.
Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
Has anyone else had this problem?
Normally it works like this:
shut down MySQL
change the [mysqld] and [mysqld_safe] datadir variable in the MySQL configuration
change the basedir variable in the same section.
move the location over
restart MySQL
If that doesn't work I have no idea. On linux you can try to move the socket to a new location too, but that shouldn't affect windows. Alternatively you can use a symbolic link on *nix what most people do I guess.
In Windows
Navigate to C:\Program Files\MySQL\MySQL Server 5.4\ and locate the my.ini file
Find the SERVER SECTION and go to approx line 76 and modify the datadir line to where you want your MySQL application data to be stored
Now navigate to C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.4\data\ and copy and paste the mysql folder into your new location.
Restart the MySQL Server in Control Panel > Administrative Tools > Service
You also have to manually modify mysql's configuration (usually my.conf)
MySQL Administrator cannot be used for tasks like this. It is merely a tool for looking at MySQL servers, despite its name. Relocating data is described in many MySQL tutorials and in the manual IIRC. But basically it's just moving the data to a new location while the server is shut down and then correcting the paths in the servers config file.
After that you should be able to restart the server and connect MySQL Administrator to it.
Make sure you give the Network Service Full permissions in the security tab of Windows Explorer options. If the server can't read/write etc. to the selected folder the service will either not start or it will attempt a start and shut right down.