I have installed bitnami's version of WAMP on Windows 10 (bitnami-wampstack-7.1.28-0-windows-x64-installer)
Everything is working fine, except now I must move the data directory to another disk. I changed my.ini as follows:
datadir="D:/bitnami/data"
In accordance with http://forum.wampserver.com/read.php?2,123685
I changed the header to :
[wampmysqld64]
It still doesn't work.
Why is the variable datadir not pointing MySQL to the new directory?
Please remove the data of the wampmysqld section and rename the wampmysqld64 one to mysqld.
I just followed these steps to rename the folder and they worked.
Stop MySQL
Edit the datadir and log-error under the mysqld section
...
# The MySQL server
[mysqld]
...
# set datadir to the location of your data directory
datadir="D:/bitnami/data"
...
log-error="D:/bitnami/data/mysqld.log"
...
Copy the content of the current data folder to the new one.
Start MySQL again
Related
I always copy a folder of MySQL db data into C:\ProgramData\MySQL\MySQL Server [x.x]\Data folder. And this db schema would appear after I restart the MySQL service.
However, this time I installed a new MySQL on a computer and followed the old way throwing MySchema folder into C:\ProgramData\MySQL\MySQL Server [x.x]\Data and restarted the service. It didn't work.
I checked my.ini datadir = C:\ProgramData\MySQL\MySQL Server [x.x]\Data.
What did I miss?
Edit:
I find a clue, my newly installed MySQL the table extension name is ibd, but my data table is frm, MYD and MYI.
I am running an Xubuntu 16.04 machine, and have installed mysql version 5.6. I wanted to change the mysql settings buffer pool size among other things. I tried editing /etc/mysql/my.cnf, /etc/mysql/conf.d/mysql.cnf. Then restarted mysql server. After that, when I login to mysql console and try to print the variables, I still do not see the values I entered in the config files. What am I missing?
EDIT
I have put the settings under [mysqld] section. Below is the content of the above files:
[mysqld]
innodb_buffer_pool_size=4G
innodb_log_buffer_size=512M
innodb_log_file_size=2G
innodb_write_io_threads=16
innodb_flush_log_at_trx_commit=0
Recently I have installed Percona 5.7.12 in my linux box but I have not found any configuration file(like my.cnf for mysql) where i can set/modify global variables.
I want to change the values of default system variables like 'sql_mode', password_policy etc.I tried setting values like *SET GLOBAL sql_mode = 'ALLOW_INVALID_DATES';* but after restart of mysqld instance, it seems old default values are retained.How can I set those values permanently so that modified values are retained??? Any help would be appreciated.
According to Percona's install guide, the config file should be located under /etc/my.cnf:
Percona Server stores the data files in /var/lib/mysql/ by default. You can find the configuration file that is used to manage Percona Server in /etc/my.cnf.
If there is no such file in the /etc directory, then you can create it yourself and set any config parameters there. Parameters in the config file are preserved across MySQL system restarts.
It's this file /etc/mysql/conf.d/mysql.cnf in my Percona 5.7 installation.
I can find it by following these steps:
mysqladmin --help
The output contains these lines:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
The first file (/etc/my.cnf) doesn't exist on my machine.
The second one (/etc/mysql/my.cnf) contains these lines:
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/percona-server.conf.d/
This file /etc/mysql/conf.d/mysql.cnf in the first directory contains the settings I would expect in /etc/my.cnf.
I was facing this same issue. Found that the xtrabackup versions at both the servers were way different (8.0.23 at the source where the backup was taken and 2.4.9 at the destination where I was trying to restore the backup).
As soon as I upgraded the xtrabackup version to 8.0.23 on the destination server, the "prepare" went smoothly without any issues.
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
When I am trying to check binary log:
SHOW BINARY LOGS;
I get this error:
ERROR 1381 (HY000): You are not using binary logging.
How to resolve this? Can anybody help?
Set the log-bin variable in your MySQL configuration file, then restart MySQL.
An example my.cnf (on Linux/unix) or my.ini (on Windows) would look like:
[client]
...
[mysqld]
...
log-bin=mysql-bin
---
Once restarted, MySQL automatically creates a new binary log (does so upon every restart).
You may also wish to look at the following variables:
server-id = 1
expire_logs_days = 4
sync_binlog = 1
Read details on the MySQL documentation. If you're after replication setup (a primary reason for using binary logs), check out Replication configuration checklist.
Line
log-bin=mysql-bin
must placed above lines:
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
You will need to activate binary logging at startup
Add the following lines in /etc/my.cnf under the [mysqld] section
[mysqld]
log-bin=mysql-bin
expire-logs-days=7
Then, run this
service mysql restart
The next time you login to mysql, you will see a binary log listing and will rotate out after 7 days.
The default location of the binary logs will be /var/lib/mysql or where datadir is defined. If you specify a folder before the binlog name, then that folder is the location.
For example
[mysqld]
log-bin=/var/log/mysql-bin
expire-logs-days=7
UPDATE 2012-07-12 02:20 AM EDT
Please restart mysql as follows and tell us if binary logging in on
service mysql restart --log-bin=mysql-bin
To enable the binary log, start the server with the --log-bin[=base_name] option.
If no base_name value is given, the default name is the value of the pid-file option (which by default is the name of host machine) followed by -bin.
If the basename is given, the server writes the file in the data directory unless the basename is given with a leading absolute path name to specify a different directory. It is recommended that you specify a basename.
Or you can directly use:
log-bin=mysql-bin
and then restart your mysql service. Then binary file will be generated. If you are using lampp on Linux machine then you will find this file in /lampp/var/mysql/mysql-bin.000001
FWIW, I had the same issue after I tried to set up my.cnf.master and my.cnf.slave files and symlink them to my.cnf for master and slave, respectively. The idea was to be able to switch the machine from master to slave and back easily.
It turned out that mysqld simply did not handle the symlink as expected. Hard-linking the file worked (ln my.cnf.master my.cnf). Careful if you do something like this, as overwriting one of the hard-linked filenames could break the link and create two separate files instead (depending on the method of rewriting employed by the software you use for it).
I've found logging will silently fail to happen even if my.cnf config is right, so you can also try re-creating your log folder.
This may be necwssary if the logs are in an odd state. (In my case, I had simply ceased logging in my.cnf and then re-enabled it, but nothing happened, probably because the existing files were not the latest updates?).
Something like this should work:
sudo service mysql stop
sudo mv /var/log/mysql /tmp/mysqlold # or rm -fr if you're brave
mkdir /var/log/mysql
chown -R mysql:mysql /var/log/mysql
sudo service mysql start
Obligatory warning: Obviously, take care when deleting anything on a database server. This will destroy/disrupt/corrupt any replication using this database as master (though you can resume replication as a slave). That said, I believe this should be safe insofar as it doesn't delete the database itself.
I went out of my mind with this issue on a MySQL 5.5 master running Debian. None of the above worked. Finally, I rebooted the server and logging was enabled.
Remove section [mysqld_safe] and replace with [mysqld].
It works for me.