I downloaded XAMPP for OS X 5.6.14 for OS X that includes MariaDB.
Now I want to change the datadir from the database but that does not work. If I start mysql the lights from XAMPP controls are red but the service "mysql" is running...
my.cnf looks like this:
[client]
socket = /Users/tobias/Documents/Webserver/mysql/mysql.sock
[mysqld]
socket = /Users/tobias/Documents/Webserver/mysql/mysql.sock
datadir = /Users/tobias/Documents/Webserver/mysql/
innodb_data_home_dir = /Users/tobias/Documents/Webserver/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /Users/tobias/Documents/Webserver/mysql/
I copied all files from the old directory to the new one and tried to start mysql.
After that, I got this error messages:
2015-12-05 19:50:18 140735225118720 [ERROR] Missing system table mysql.roles_mapping; please run mysql_upgrade to create it
2015-12-05 19:50:18 140735225118720 [ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH'), found type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_A
2015-12-05 19:50:18 140735225118720 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
Then I run mysql_upgrade and the errors were gone.
I've got no error in log but database does not start... service is running, but lights in Manager are red. phpmyadmin can not connect to db
Does anybody has an tutorial how I can move mysql database directory to a new one?
Permissions of the new folder is set to mysql:mysql
Thanks!
Related
I know there are countless questions and posts about this, but I'm getting an error when trying to start the MySQL Server and I don't know how to solve it.
So to explain I cannot access my database so I tried to reset the password of the root user. I've followed this guide however I've had no luck. First I had issues with permissions on my machine and now I'm getting this error:
1105 Bootstrap file error, return code (0). Nearest query: ''
Technically the MySQL Server is starting, however the init-file is not being run, and so my password is not being reset.
Command I am running is this:
mysqld --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 5.7\\my.ini" --init-file=C:\\mysql-init.txt --console
Contents of mysql-init.txt
ALTER USER 'root'#'localhost' IDENTIFIED BY 'new_password';
The following is the part of the log where the error is shown:
[Note] Execution of init_file 'C:\\mysql-init.txt' started.
[ERROR] 1105 Bootstrap file error, return code (0). Nearest query: ''
[Note] Execution of init_file 'C:\\mysql-init.txt' ended.
[Note] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe: ready for connections.
MySQL Version: 5.7
OS: Windows 10
Actually you can pass the command:
--init-file=C:\\mysql-init.txt
as a parameter to start the MySQL service from its general tab.
(Source)
Had two errors with MySQL 5.7.24
1.) The script file must be in a separate folder (not mysql installation folder or data directory)
and that folder must get "secure-file-privileges"
2.) The error above was raised for the script did not end with a ';'
Succeeded then with command line statement as
mysqld --datadir=D:\ProgramData\mysql\data --init-file=D:\ProgramData\mysql\reset\reset.sql --secure-file-priv=D:\ProgramData\mysql\reset --console
and SQL-script file 'reset.sql' as
alter user 'root'#'localhost' identified by 'root_pwd';
For me, on Ubuntu, problem was init file was not owned by mysql user.
chown mysql:mysql /tmp/reset_mysql_pswd.sql
sudo mysqld --init-file=/var/lib/mysql/reset_mysql_pswd.sql
# ^C or kill -9 <mysqld pid>
systemctl stop mysql.service
systemctl start mysql.service
Even when the folder containing the init file and the init file itself had permissions 777 (which is a bad idea), I still get:
2020-04-10T23:14:48.030719Z 0 [Note] Execution of init_file '/tmp/reset_mysql_pswd.sql' started.
2020-04-10T23:14:48.030764Z 0 [ERROR] mysqld: File '/tmp/reset_mysql_pswd.sql' not found (Errcode: 13 - Permission denied)
2020-04-10T23:14:48.030772Z 0 [ERROR] Aborting
I have MacOS Sierra. I have installed MySQL Server which has been working, however, after a reboot of the Mac Book, I cannot start the MySQL Server.
I have tried changing the port from 3306 to 3307 in the my.cnf file.
Question
I would appreciate any help on how to start the MySQL Server, and also have it so it starts automatically on MacOS Boot up.
(I am new to Mac, so apologies if this is a basic question).
UPDATE
Looking for error logs, I can't find anything with todays (2/2/2017) timestamp.
Nothing in the data dir:
No files with "mysql" have been modified since I've tried to start the MySQL Server (2/2/2017 after 09:00).
I suggest using Terminal commands.
Start MySQL
sudo /usr/local/mysql/support-files/mysql.server start
Stop MySQL
sudo /usr/local/mysql/support-files/mysql.server stop
Restart MySQL
sudo /usr/local/mysql/support-files/mysql.server restart
In my case, I had inadvertently transferred ownership of entire /usr/local directory to myself, which resulted in snatching-away of write permission of /usr/local/mysql-5.7.20-macos10.12-x86_64/data directory from the daemon user called "_mysql".
Restoring the ownership fixed the issue.
After a discussion with Richard, the following solves the issue:
my.cnf:
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
datadir = /usr/local/mysql-5.7.17-macos10.12-x86_64/data
tmpdir = /tmp
Essentially, although we'd added the relevant stanza's to the my.cnf file, we'd still missed the section heading. Adding the [mysqld] section allowed mysql to start.
After installing Mysql 8.0.12 on MacOS High Sierra, Mysql server would not start up. I tried several suggestions like removing mysql and reinstalling it, rebooting the computer and changing file permissions, all to no avail. I finally got it to work by removing /etc/my.cnf.
In my case, ownership of the msyql directory had somehow changed to admin:admin. I use ares suggestion to run mysqld from the terminal:
sudo /usr/local/mysql/support-files/mysql.server start
Which showed a permissions error writing to a msyql file.
I fixed with this command:
sudo chown -R _mysql:wheel /usr/local/mysql/data
from this post:
What user should own /usr/local/mysql on Mac?
In my case, First time, after installing Mysql, Mac needs a restart.
So restarting Mac, after installation, fixed the issue for me.
MacOS doesn't come with a my.cnf file. Default settings will suffice the needs for basic usage. Once we need to override them, it makes sense to have a custom configurations.
This solution works for me.
You have to open the activity monitor up and search for mysqld service. Once selected, just click the delete button located in the up left part and you will see the memory goes down. After that, you can verify your mysql server status from System Preferences and the service is up.
With this solution you don't have to restart your machine and get to work fast.
My problem was that due to an incorrect restart of my machine, a database was corrupted. According to their docs doing a forced InnoDB Recovery did the trick:
/etc/my.cnf
innodb_force_recovery = 2
My problem was that I installed MySQL a while ago with Homebrew (forgot I did) and then went the more manual route, so I think the two installs were fighting each other. I wiped my Mac of both with the help of this walkthrough: https://gist.github.com/vitorbritto/0555879fe4414d18569d
Note: Where it says to use subl - that's Sublime, use whatever editor you like.
I was able to get things to work with a fresh install after that.
I had this same issue on Monterey. Make sure you're selecting the correct download according to your processor architecture.
I ran into same problem with following .err log.
MacOS: Catalina 10.15.7.
MySQL version: 5.7.19.
2021-08-19T02:17:26.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2021-08-19T02:17:27.303813Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-08-19T02:17:27.318280Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2021-08-19T02:17:27.335112Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.19) starting as process 2828 ...
2021-08-19T02:17:27.421394Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2021-08-19T02:17:27.428986Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2021-08-19T02:17:27.429541Z 0 [ERROR] Aborting
2021-08-19T02:17:27.429688Z 0 [Note] Binlog end
2021-08-19T02:17:27.432786Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
And I found adding --user=root to Ares's answer will start mysql server successfully.
sudo /usr/local/mysql/support-files/mysql.server start --user=root
Ref.: MySQL Server Command User Options
[root#wwwlxg bin]# ./mysqld --initialize --user=mysql --basedir=/opt/mysql/mysql --datadir=/opt/mysql/mysql/data
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
[Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
[ERROR] Can't find error-message file '/opt/mysql/mysql/data/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
[Warning] InnoDB: New log files created, LSN=45790
[Warning] InnoDB: Creating foreign key constraint system tables.
[Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 73963455-d30a-11e6-bf4f-3aa0c659e827.
[Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
[Note] A temporary password is generated for root#localhost: t&VhwEgod4rm
hereis my.cnf
# These are commonly set, remove the # and set as required.
basedir = /opt/mysql/
datadir = /opt/mysql/data
port = 3306
server_id = 1
socket = /tmp/mysql.sock
lc_messages_dir = /opt/mysql/data
language = /opt/mysql/share/english
there is an error about 'lc-messages-dir' i want to know what's that and how i can fix it?(this question was solved) because i add this to my.cnf :lc_messages_dir = /opt/mysql/data
another error when i mysql.server start
ps -ef|grep mysql
no other mysql is running
ls -l /opt/mysql
im sure /opt/mysql is mysql:mysql
Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/wwwlxg.pid).
im running: centos6.4 mysql-5.7.17-linux-glibc2.5-x86_64
try
my.cnf
[mysqld]
...
lc_messages_dir = /opt/mysql/share
lc_messages = en_US
errmsg.sys usually in /{mysql-path}/mysql/share/{language}/, {language} would be 'english', 'spanish' ...
for more detail: http://dev.mysql.com/doc/refman/5.7/en/error-message-language.html
Generally when you install MySQL, a directory for lc_messages configuration is created in the system, normally in /usr/share/mysql-.
The correct configuration in my.cnf for this is the following (in my case MySQL 8.0):
[mysqld]
lc-messages-dir = /usr/share/mysql-8.0
lc-messages = en_US
If you specify directly the language in the lc-message-dir such as /usr/share/mysql-8.0/english where the errmsg.sys is, then you will receive the following warning:
Using pre 5.5 semantics to load error messages from
/usr/share/mysql-8.0/english/. If this is not intended, refer to the
documentation for valid usage of --lc-messages-dir and --language
parameters.
The key is using the lc-messages-dir and lc-messages correctly.
you must make the --defaults-file=# as first parameter in one line, like this :
./bin/mysqld --defaults-file=my57.cnf --initialize
see more :https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization.html
hope helpful to you :)
It looks like the path of the file errmsg.sys does not exist.
Check if the folder /opt/mysql/mysql/data exists and if not, create it.
Maybe you also have to adjust the permissions of this folder by using chown mysql:mysql /opt/mysql/mysql/data.
I installed MySQL community server 5.7.10 using binary zip. I extracted the zip in c:\mysql and created the data folder in c:\mysql\data. I created the config file as my.ini and placed it in c:\mysql (root folder of extracted zip). Below is the content of the my.ini file
# set basedir to your installation path
basedir=C:\mysql
# set datadir to the location of your data directory
datadir=C:\mysql\data
I'm trying to start MySQL using mysqld --console, but the process is aborted with the below error.
2015-12-29T18:04:01.141930Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2015-12-29T18:04:01.141930Z 0 [ERROR] Aborting
Any help on this will be appreciated.
You have to initialize the data directory by running the following command
mysqld --initialize [with random root password]
mysqld --initialize-insecure [with blank root password]
The mysql_install_db script also needs the datadir parameter:
mysql_install_db --user=root --datadir=$db_datapath
On Maria DB you use the install script mysql_install_db to install and initialize. In my case I use an environment variable for the data path. Not only does mysqld need to know where the data is (specified via commandline), but so does the install script.
mysqld --initialize to initialize the data directory then mysqld &
If you had already launched mysqld& without mysqld --initialize you might have to delete all files in your data directory
You can also modify /etc/my.cnf to add a custom path to your data directory like this :
[mysqld]
...
datadir=/path/to/directory
As suggested above, i had similar issue with mysql-5.7.18, i did this in this way
1. Executed this command from "MYSQL_HOME\bin\mysqld.exe --initialize-insecure"
2. then started "MYSQL_HOME\bin\mysqld.exe"
3. Connect workbench to this localhost:3306 with username 'root'
4. then executed this query "SET PASSWORD FOR 'root'#'localhost' = 'root';"
password was also updated successfully.
I had the same problem. For some reason --initialize did not work.
After about 5 hours of trial and error with different parameters, configs and commands I found out that the problem was caused by the file system.
I wanted to run a database on a large USB HDD drive. Drives larger than 2 TB are GPT partitioned! Here is a bug report with a solution:
https://bugs.mysql.com/bug.php?id=28913
In short words: Add the following line to your my.ini:
innodb_flush_method=normal
I had this problem with mysql 5.7 on Windows.
My problem was caused by an incorrect db restore.
When I dumed the db it also picked up the system mysql tables because I added a space after -p as mentioned here: mysqldump is dumping undesired system tables
Launching the docker instance would work, then I'd restore (and corrupt) the db and it would still keep running, but after restarting it would Exit with error code 1.
The solution was to dump and restore properly without the system tables.
I face the same issue with version Mysql 5.7.33 when the server has rebooted. I fix it by copy other server user files scp /var/lib/mysql/mysql/user.* root#dest:/var/lib/mysql/mysql.
I am using XAMPP and I am trying to access phpMyAdmin through http://localhost/phpmyadmin, but I'm getting this error message:
Error
SQL query:
SHOW PLUGINS
MySQL said:
#1 - Can't create/write to file '/var/folders/_y/gtpc137d1q9gkvsj0dsxjd040000gn/T/#sql9f2_8_0.MYI' (Errcode: 13)
I haven't tried to access it in a while so I don't know what has changed since the last time. Can anyone shed light on this for me? I've Googled and can't seem to understand what most people are talking about in related issues.
Also, my XAMPP won't connect to Apache anymore either (it just keeps giving me the loading image).
Here is the error I'm getting:
121201 22:59:27 mysqld_safe Starting mysqld daemon with databases from /Applications/XAMPP/xamppfiles/var/mysql
Warning: World-writable config file '/Applications/XAMPP/xamppfiles/etc/my.cnf' is ignored
121201 22:59:28 [Warning] Setting lower_case_table_names=2 because file system for /Applications/XAMPP/xamppfiles/var/mysql/ is case insensitive
121201 22:59:28 [Note] Plugin 'FEDERATED' is disabled. /Applications/XAMPP/xamppfiles/sbin/mysqld: Can't create/write to file '/var/folders/_y/gtpc137d1q9gkvsj0dsxjd040000gn/T/ibCVKOvf' (Errcode: 13)
121201 22:59:28 InnoDB: Error: unable to create temporary file; errno: 13
121201 22:59:28 [ERROR] Plugin 'InnoDB' init function returned error.
121201 22:59:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
121201 22:59:29 [Note] Event Scheduler: Loaded 0 events
121201 22:59:29 [Note] /Applications/XAMPP/xamppfiles/sbin/mysqld: ready for connections.
Version: '5.1.44' socket: '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock' port: 3306 Source distribution
Following line in the log is the reason:
"Warning: World-writable config file
'/Applications/XAMPP/xamppfiles/etc/my.cnf' is ignored"
As Rishi Kalia has pointed out already you have to set the correct permissions:
Open Terminal
Navigate to the XAMPP config folder
cd /Applications/XAMPP/xamppfiles/etc/
Set permissions of my.cnf to 600
sudo chmod 600 my.cnf
Restart MySQL.
I had to reset the permissions in my xampp folder because I needed to be able to INSERT images into a folder in the htdocs, via php from website I am building.
However after I changed the permission I got : Errcode: 13
The process listed above works but I am adding some additional notes for people who have no clue how to use the terminal.
1. Open Terminal
The Terminal is in Applications/Utilities/Terminal
2. Navigate to the XAMPP config folder
pwd shows the path listing to the current directory
cd changes the current directory
ls -a lists all the files in that directory
Enter this code into the terminal:
cd /Applications/XAMPP/xamppfiles/etc/
3. Set permissions of my.cnf to 600
Enter this code into the terminal:
sudo chmod 600 my.cnf
4. Restart MySQL
VoilĂ !
you have to go to your xampp installation directory and change the permissions of my.cnf to 600
Sometimes you might have installed an application or a server which accesses the same port which is used by XAMPP. Try changing the port for the XAMPP server. Following link will help you.
http://veerasundar.com/blog/2009/07/how-to-change-xampp-server-port/
If you changed the write and read permissions in all the enclosed items inside the XAMPP main folder ("/Applications/XAMPP"), be sure to make this folder Readable and Writable for everyone: "/Applications/XAMPP/xamppfiles/var/mysql".
This can be done accessing to that folder from the Finder and then Get Info (Cmd + I), in the "Sharing & Permissions" click the lock icon, type your password and change "everyone - read only" to "everyone - read & write", and be sure to make that change for all the enclosed items as well (clicking the gear icon and then "Apply to enclosed items...").
Hope this helps!
Pretty simple... once you take ownership of xamppfiles, you also need to update my.cnf file in the xamppfiles/etc/ directory.
Default MySQL password is mysql.
Once you authorized httpd service to run as User yourusername (OS X) Group yourgroup(id).
Open terminal and type in sudo whoami, this will tell you. In the my.cnf file, replace mysql with your user name.
Restart Apache.
Your username.pid file will be automatically updated.
enter in folder etc
excute commande
sudo chmod 600 my.cnf
restart mysql server