MySQL abort right after starting - mysql

Like described in the title, mysql stop just after starting, i searched in a lot of topics and every solutions proposed doesn't work for me...
i'm on up to date os x with a fresh install of mysql 8.0 via DMG.
my my_pc.err file in the mysql/data folder indicate this:
2020-05-20T14:43:07.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2020-05-20T14:43:07.693358Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.20) starting as process 25586
2020-05-20T14:43:07.697083Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2020-05-20T14:43:07.697155Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2020-05-20T14:43:07.697233Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-20T14:43:07.697410Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
2020-05-20T14:43:07.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/MacBook-Pro-de-CanardWc.local.pid ended
2020-05-20T14:43:17.6NZ mysqld_safe Logging to '/usr/local/mysql/data/MacBook-Pro-de-CanardWc.local.err'.
2020-05-20T14:43:17.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
It's been now few years that i try to use mysql and never manage to make it working. I tried :
sudo /usr/local/mysql/support-files/mysql.server start, it gave me this :
Starting MySQL . ERROR! The server quit without updating PID file (/usr/local/mysql/data/MacBook-Pro-de-CanardWc.local.pid).
i used chmod on my mysql folder.
i changed my path on bash_profile but mysql and mysqld commands is still not found.
i also tried this:
/usr/local/mysql/bin/mysqladmin --port=8889 -u root shutdown
it responds this:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38)'
Check that mysqld is running and that the socket: '/var/mysql/mysql.sock' exists!
ps -ef | grep mysqld gave me this information :
501 22093 549 0 6:52PM ttys004 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox mysqld
/usr/local/mysql/bin/mysql -h 127.0.0.1 -P 3306 -u root -p
give this:
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)
my /var/mysql/mysql.sock is empty
sudo pkill mysqld
doesn't kill the process
did a fresh reinstal using https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks but when i do mysql_secure_installation i got this error:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

After few search, i found out that that i just needed to uninstall it and reinstall it with brew. Pretty sad that the dmg doesn't work but now i can use mysql properly.
Thanks a lot for the time you took to help me <3

Related

Linux MySQL Permission denied on dynamic mounted drive

So I've installed MySQL on my PC (Linux Mint 21).
I mounted the dynamic NTFS Windows drive via ldmtool and tried to launch MySQL:
$ mysqld --datadir=/media/ffx/Data/MySQLDB
Got an 13 error (Permission denied).
Then:
# mysqld --user=root --datadir=/media/ffx/Data/MySQLDB
Same error...
Full log:
2022-12-01T15:43:28.814379Z 0 [Warning] [MY-010091] [Server] Can't create test file /media/ffx/Data/MySQLDB/mysqld_tmp_file_case_insensitive_test.lower-test
2022-12-01T15:43:28.814433Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.22.04.1) starting as process 6743
2022-12-01T15:43:28.816359Z 0 [Warning] [MY-010091] [Server] Can't create test file /media/ffx/Data/MySQLDB/mysqld_tmp_file_case_insensitive_test.lower-test
2022-12-01T15:43:28.816365Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /media/ffx/Data/MySQLDB/ is case insensitive
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2022-12-01T15:43:28.817066Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-12-01T15:43:28.817153Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31-0ubuntu0.22.04.1) (Ubuntu).
I remounted the drive and set the 'ffx' owner (my account) instead of root
But this:
# mysqld --user=root --datadir=/media/ffx/Data/MySQLDB
$ mysqld --user=ffx --datadir=/media/ffx/Data/MySQLDB
$ mysqld --datadir=/media/ffx/Data/MySQLDB
Are also failed.
I remounted the disk to set the 'mysql' owner (so mysql:mysql is owner of WHOLE disk):
# mount /dev/mapper/... /media/ffx/Data -o uid=mysql -o gid=mysql
Now mysql user is owner of whole disk and it still gives that 13 error.
I've tried launch it from the root, ffx and mysql and got failed with the same error.
I also did this after every error:
# chown -R mysql:mysql /media/ffx/Data/MySQLDB
# chown -R mysql:mysql /media/ffx/Data/MySQLDB/
# chown -R mysql:mysql /media/ffx/Data/MySQLDB/*
but it also failed.
No result:
$ mysqld --install
$ mysqld --initialize
Creating an init file with
ALTER USER 'root'#'localhost' IDENTIFIED BY 'YourNewPassword';
Giving an 777 access to Data;
Giving an 777 access to MySQLDB
So question is what should I do and why doesn't it have permissions.

What's default password in docker container mysql-server when you don't set one?

I am try to run a mysql container and connect with mysql client then:
I've used following commands:
docker run --name=mysql -d mysql/mysql-server:latest
docker exec -it mysql mysql -uroot -p
According to tutorial, the last command allow me configure database password but When I introduce the first password it fails...
The first password was root and I get an unusual error, then I try with admin, admin an even my linux user password but They don't work...
I would like to know what's the error?
There are couple of ways to see the password.
First Approach - Don't Run container in daemon mode
Check the below command
docker run --name=mysql mysql/mysql-server:latest
and this will print the password in the terminal as look at the below logs
2020-05-28T23:41:01.418347Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock'
2020-05-28T23:41:01.666070Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-05-28T23:41:01.714420Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20' socket: '/var/lib/mysql/mysql.sock' port: 0 MySQL Community
Server - GPL.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
[Entrypoint] GENERATED ROOT PASSWORD: PopiKQIjAS#OGj3x]yJOBLEn80p
[Entrypoint] ignoring /docker-entrypoint-initdb.d/*
2020-05-28T23:41:06.208480Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.20).
2020-05-28T23:41:07.861667Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
[Entrypoint] Server shut down
[Entrypoint] Setting root user as expired. Password will need to be changed before database can be used.
[Entrypoint] MySQL init process done. Ready for start up.
[Entrypoint] Starting MySQL 8.0.20-1.1.16
2020-05-28T23:41:08.534785Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1
2020-05-28T23:41:08.549216Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-05-28T23:41:09.135591Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-05-28T23:41:09.369412Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
2020-05-28T23:41:09.448584Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-05-28T23:41:09.500464Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Communi
ty Server - GPL.
Second Approach - Run container in daemon mode & fetch the password from logs
Check the below command to run the container
docker run -d --name=mysql mysql/mysql-server:latest
and then run the below command to fetch the password
docker logs mysql 2>&1 | grep GENERATED
Output of above command is:
[Entrypoint] GENERATED ROOT PASSWORD: PopiKQIjAS#OGj3x]yJOBLEn80p
Once you have the password by one of the above-mentioned methods, you can then login with the below command using that password
docker exec -it mysql mysql -uroot -p
When asked, enter the generated root password (see the instructions above on how to find it). Because the MYSQL_ONETIME_PASSWORD option is true by default, after you have connected a mysql client to the server, you must reset the server root password by issuing this statement:
mysql> ALTER USER 'root'#'localhost' IDENTIFIED BY 'password';
Substitute password with the password of your choice. Once the password is reset, the server is ready for use.
Ref: https://hub.docker.com/r/mysql/mysql-server/
docker inspect <container_name_here> command output shows root password among other params
When starting a mysql container for the first time, there is no default password. The password you set while running the container is the default password that will be assigned to your root.
Starting a MySQL instance is simple:
$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
where some-mysql is the name you want to assign to your container, my-secret-pw is the password to be set for the MySQL root user and tag is the tag specifying the MySQL version you want. See the list above for relevant tags.
Following the documentation in: https://dev.mysql.com/doc/refman/8.0/en/docker-mysql-getting-started.html
You get the password with command:
docker logs mysql 2>&1 | grep GENERATED
Example output:
GENERATED ROOT PASSWORD: Axegh3kAJyDLaRuBemecis&EShOs
There is no default password, try login in using:
sudo docker exec -it mysql mysql -u root

Keyring mirgration failure Fedora mySql

I've been working through MySQL but I've been having trouble entering my MySQL server to change certain properties. When I attempt to enter as root I get the following output:
//]$ sudo mysqld -u root -p
Enter password:
mysqld: Can not perform keyring migration : Invalid --keyring-migration-source option.
2020-02-12T05:34:59.837715Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.19) starting as process 64421
2020-02-12T05:34:59.839462Z 0 [ERROR] [MY-011084] [Server] Keyring migration failed.
2020-02-12T05:34:59.839481Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-02-12T05:34:59.839559Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.19) MySQL Community Server - GPL.
Can't figure out how to sort this out. Any help would be much appreciated.
keyring-migration-source exists in one of the configuration files.
mysqld --help --verbose will list which files are read at the top. Look in those and remove the line.
Also don't run mysqld as root. Its a security hazard and won't start. Use the systemctl start mysql that fedora provides.

Can't start sudo mysqld with --skip-grant-tables

I am looking at these instructions to reset the mysql root password on an Ubuntu development machine.
#> sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
Seems to work but then
#> sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking
2016-09-04 15:27:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-04 15:27:13 0 [Note] /usr/sbin/mysqld (mysqld 5.6.31-0ubuntu0.15.10.1) starting as process 8892 ...
This process exits. Afterwards, when I try
#> mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
What's going wrong?

I installed mysql 5.1 from the official site, but am having issues

NOTE: I am using Mac OS X Lion
Two issues in particular:
1) The server won't start when I try to start it from the pref pane
2) I get this error when I type "mysql" in the command line. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
When I type mysqld, I get the following error:
120328 17:28:55 [Warning] Can't create test file /usr/local/mysql-5.1.62-osx10.6-x86_64/data/Shaans-MacBook-Pro.lower-test
120328 17:28:55 [Warning] Can't create test file /usr/local/mysql-5.1.62-osx10.6-x86_64/data/Shaans-MacBook-Pro.lower-test
mysqld: Can't change dir to '/usr/local/mysql-5.1.62-osx10.6-x86_64/data/' (Errcode: 13)
120328 17:28:55 [ERROR] Aborting
120328 17:28:55 [Note] mysqld: Shutdown complete
When I type "sudo mysqld", I get the following error:
120328 17:45:48 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.1.62-osx10.6-x86_64/data/ is case insensitive
120328 17:45:48 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
120328 17:45:48 [ERROR] Aborting
120328 17:45:48 [Note] mysqld: Shutdown complete
When I type "sudo mysqld_safe", I get the following response:
120328 17:50:26 mysqld_safe Logging to '/usr/local/mysql/data/Shaans-MacBook-Pro.local.err'.
120328 17:50:26 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
120328 17:50:32 mysqld_safe mysqld from pid file /usr/local/mysql/data/Shaans-MacBook-Pro.local.pid ended
Use mysqld to start the server - mysql starts the command line interface, not the daemon.
Depending on what distro you have, these commands may work, I use Ubuntu Server 10.04
I type:
sudo service mysql stop
sudo service mysql start
sudo service mysql restart
To perform those functions