MySQL database file on Mac OS [duplicate] - mysql

This question already has answers here:
MySQL data directory location
(9 answers)
Closed 7 years ago.
A really dumb question. I have used MySQL workbench created a new database/schema (on the same local Mac OS box), and wondering what are path of the database physical folder, which it stores data/index files?
BTW, I did search by database name, but cannot find anything. :(
thanks in advance,
Lin

Ok, either issue a show variables where variable_name='datadir'; then follow up with scrutiny of folders underneath it. Folders are the schema/db folders.
Or look at the answer Here on the Stack pointing one to examining the /etc/my.cnf file that may contain:
[mysqld]
datadir=/var/lib/mysql
on my Windows box they would appear as
C:\ProgramData\MySQL\MySQL Server 5.6\data>dir /ad
Directory of C:\ProgramData\MySQL\MySQL Server 5.6\data
09/13/2015 01:36 PM <DIR> ajax_stuff
07/14/2015 09:52 PM <DIR> mysql
...
11/11/2015 10:37 PM <DIR> so_gibberish
09/21/2015 01:10 PM <DIR> real_secret_stuff
Sorry, not on my mac at the moment

Related

Unable to Start mysql after Update from 5.0.12 to 5.7.18

I tried to update MySQL from 5.0.12 to 5.7.18 but unable to start MySQL after upgrade. I performed following steps.
I downloaded Zip Archive file from MySQL Community Server.
I extracted the archive file in Temp Folder.
I renamed the mysql folder to mysql_backup
I created a new mysql folder and pasted all the newly extracted files in that folder
I copied data folder from old mysql_backup folder to newly created mysql folder.
I copied my.ini from old mysql_backup folder to new mysql folder's bin directory.
I tried to start mysql service but it gives error.
I removed following line as per this suggestion but still same error.
innodb_additional_mem_pool_size = 2M
There is nothing in error log of mysql. It seems to be my.ini issue. Please help me out.
At last I have found the answer using Windows Event Viewer. The issue was with the below line in [mysqld] section which I have commented-out/removed from my.ini file and now MySQL have started:
key_buffer = 16M
After commenting this out this line will be:
#key_buffer = 16M
Please do check your Windows Event Viewer for more clues to the errors in XAMPP Control Panel.
In my case, I had to move the my.ini file from /data folder to /bin folder

Location of MySQL configuration file (ie: my.cnf) not specified

Location of MySQL configuration file (ie: my.cnf) not specified
How can I fixed this thing?
I been trying to reinstall mysqlserver 5.5 / 5.7 and workbench countless of time. But I still not able to fix this issue.
I solved this problem. Step one: click here
Step two: and then click here to choose your path
Step three: my path is C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
If you already know where your configuration file is located, but just don't know how to specify it in mySQLWorkbench, you can skip steps 1-3 and just follow step 4 in these instructions.
Step 1: Make sure which mysql is running (just in case you have multiple installations on your system) and how:
$ ps aux | grep mysql
may result in something like:
_mysql 120 0,0 3,4 5122736 565108 ?? Ss Fr01pm 61:05.93 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid
If, in this output, you see that mysqld has been started with the --defaults-file option, that option specifies the configuration file used by msql. If so, you have found the configuration file and can skip to step 4.
If not, check if this returns the same binary location as above command:
$ which mysqld
If not, then make sure you use the full path for mysqld from the first output in the following step.
Step 2: Ask mySQL which configuration files it is using:
$ mysqld --verbose --help | grep -A 1 "Default options"
should output something like:
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
Step 3: Check the given locations in that order. The first finding should be your mySQL configuration file.
Step 4: In mySQLWorkbench go to Database > Manage Connections, then select the connection, select tab System Profile, and enter the path and file name in Configuration File.
This should be it.
And if still nothing happens, you may have used the installer Package. If you have, then you must select the Installation Type from the drop-down to reflect that before you locate the configuration file.
Here's a screenshot that follows from the above screenshots
Also, there may not be a config file and you can create one here, then get out of the Options File, go back in and you will see all the options.
I changed my setting from Custom to MacOSx (MySQL Package) under: Database → Manage Connections → MySQL Connections → Select DB Connection → System Profile → Installation Type → (default setting) MySQL Package.
Change from custom to default setting:
Reconnect by testing connection:
For maria-db users
back up the original /etc/mysql/my.cnf
copy and rename /etc/mysql/mariadb.conf.d/50-server.cnf to /etc/mysql/my.cnf.
This would fix the problem.
Remember to revert changes after finish.
For those with Mac OS Catalina:
I did not have a my.cnf file. I went to /usr/local/mysql/
and created a directory named etc, which I did not have either.
Then, inside that directory, I created the file (my.cnf).
This is the link that helped me How to fix --secure-file-priv option error
for mysql 5.7 users and MAMP: just create /etc/my.cnf
macOS 13 and MySQL 8 current:
Open MySQL Workbench on your Mac. Connect into your localhost instance of MySQL.
Click the little wrench icon next to INSTANCE on the left pane above Startup / Shutdown.
Select macOS as System Type, macOS as Installation Type, and the rest will default into place. Copy the location it gives you for the my.cnf file.
Click Close
Now click Options File on the left. It will notice that you don't have a file and will show you default values.
Click the Apply... in the bottom right corner.
It will then ask you for a password of your current logged in user of your Mac to create and save the my.cnf file.
Now in the Finder use the keyboard combo of Command-Shift-G and copy in your location we copied early (i.e. /etc/my.cnf)

MySQL Errcode 2 - problems creating database directories

This doesn't seem far too specific, but somehow I cannot find anyone else with this problem (at least on stack and google). People have issues with errcode 2, but every thing I've seen is people having issues with mysql's tmp directory. I've tried changing that, and that's given no luck.
I've also made sure that the owner/group of the mysql "datadir" is mysql.
I'm assuming the cause of this is because I have recently moved the mysql datadir to my /ssd directory.
I have changed the datadir location after copying /var/lib/mysql to /ssd and have restarted mysql.
For /var/lib/mysql, I renamed the mysql folder to mysql-old, as that folder was no longer in use. Just in case, I created a symlink in place of it that points to the /ssd/mysql directory.
For context, I am trying to import an sql file and it seems it cannot create the data or directories themselves. Here is the full error:
ERROR 1 (HY000) at line 33: Can't create/write to file '/var/lib/mysql/changelog/changelog.MYI' (Errcode: 2)
In this instance, I'm trying to import a database named changelog
Even after changing the datadir entirely, it still seems to want to write to /var/lib/mysql - Why is that?
You may try to look into section [mysqld] in my.cnf or mysqld.cnf in /etc/mysql/
It could be either due to too many files being open or tmp directory having no permission for your user.
http://alvinalexander.com/mysql/mysql-cant-create-write-file-error-message
I ran into similar error message when trying to create a new database. The final solution is uninstall mysql and reinstall it again. Everything was fine. There are some corruption in the file which caused the errno 2.

mysql server data folder is not visible in windows

I'm trying to locate data folder of mysql server 5.7
When I run this query
SHOW GLOBAL VARIABLES LIKE 'datadir';
I got my data dir path, but when I actually go there in c drive its not there.
Checked all hidden properties, all are fine.
Any help ?
It could be hidden. Default datadir on Windows 10 is C:\ProgramData which is normally hidden.
This link describes initializing the data directory on Windows or UNIX-like OSs.
For Windows
Because you have problems with finding the data directory I suggest you define it yourself.
First you have to make sure the following lines are in my.ini file:
[mysqld]
basedir=C:\\Program Files\\MySQL\\MySQL Server 5.7
datadir=D:\\MySQLdata # here you could put
The second line points to your MySQL Server installation. The third line to wherever you want your data directory to be. After saving the file. You could call following command:
C:\> bin/mysqld --defaults-file=C:\my.ini --initialize
With C:\my.ini pointing to your my.ini file. Hope this helps you

Where can I find the file my.ini file for windows mysql server?

The same question is repeated again and again and i am another one repeating this question .
I have already set up my mysql server .
Its location is C:\Program Files\MySQL\MySQL Server 5.5
but i am not able to find the my.ini file inside the above path .
When i type the command c:>mysql --help
The output looks like
Default options are read from the following files in the given order:
C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf C:\Program Files\MySQL\M
ySQL Server 5.5\my.ini C:\Program Files\MySQL\MySQL Server 5.5\my.cnf
The following groups are read: mysql client
But when I opened the above locations from where it is reading these files ,I am unable to locate the file . Can anyone tell me what is the exact way to retireve the my.ini file for WINDOWS?
In MySQL 5.5 Windows the default path for my.ini is
C:\ProgramData\MySQL\MySQL Server 5.5
You may need to change your file browser (windows explorer) options to show hidden files and directories.
To configure the client and utility applications, create a new my.ini file in the Windows installation directory. More info here
I just checked my installation and located my.ini at C:\Program Files\MySQL\MySQL Server 5.5 which seems to be exactly the same like your installation path (and mysql version is the same for us). Are you sure it isn't there?
EDIT:
Possibly all you have to do is to rename one of example .ini files to my.ini (and optionally tune it to your needs), see: http://dev.mysql.com/doc/refman/5.1/en/option-files.html#option-files-preconfigured . These are: my-small.cnf, my-medium.cnf, my-large.cnf, and my-huge.cnf in your mysql installation dir. It is possible that this is just what I did in my case - it was a while ago when I installed mysql.
Under the Data folder my friend. Go one dir up from Mysql 5.5
Check variable datadir, in my default setup of 5.7 on Windows 7 it used:
C:\ProgramData\MySQL\MySQL Server 5.7
Just visit: http://opensourcedba.wordpress.com/2011/01/12/mysql-basics-part-3-%E2%80%93-your-my-cnf-or-my-ini-file/?blogsub=confirming
This has the whole content required for my.ini.
If you do not see my.ini file. Rename one of below file to my.ini
my-huge.ini
my-large.ini
my-medium.ini
my-small.ini
You can check the my.ini through the below process:
1. Through the command prompt. Type command as "Services.msc".
2. Go to MySQL56 service and right Click. Select Properties.
3. In the Properties area you will get the my.ini file path at the end.
I found the my.ini file by running SHOW VARIABLES LIKE "%datadir%"; and going one directory up.