Unable to reset MySQL Server Root Password - mysql

I tried to start MYSQL in safe mode to reset the root password, but getting the below error.
I had mysql server installed on my mac, yesterday i encountered some error where it was repeatedly shutting down automatically. However i wasn't able to connect to server using command line as it was erroring out mentioning the root password was wrong. Though I was able to connect using mysql workbench.
I reinstalled SQL Server and still not able to login using the new root password.
sudo mysqld --skip-grant-tables
2019-10-23T10:13:40.361911Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-10-23T10:13:40.362146Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-10-23T10:13:40.362217Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 4763 ...
2019-10-23T10:13:40.365571Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.7.28-macos10.14-x86_64/data/ is case insensitive
2019-10-23T10:13:40.365648Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2019-10-23T10:13:40.365676Z 0 [ERROR] Aborting
2019-10-23T10:13:40.365690Z 0 [Note] Binlog end
2019-10-23T10:13:40.365844Z 0 [Note] mysqld: Shutdown complete

Related

The innodb_system data file 'ibdata1' must be writable - access denied for user root#localhost'

I am trying to set up mySQL for the second time on my laptop. I had previously installed and run mysql-installer-web-community-8.0.22.0 without any problem couple of months ago. Recently I uninstalled that version and installed the newer one mysql-installer-web-community-8.0.23.0. I get no errors during installation, but when I want to work with MySQL workbench I get the error as "no connection established." I have already fixed services such that mySQL is running. but I get the error message for not being able to connect to the localhost.
I have tried the following commands, but I get the following error messages.
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p
Enter password: ****
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --console
2021-03-23T12:38:52.603298Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.23) starting as process 8452
2021-03-23T12:38:52.661405Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-03-23T12:38:52.666405Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2021-03-23T12:38:52.668889Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2021-03-23T12:38:52.670851Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2021-03-23T12:38:52.674130Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2021-03-23T12:38:52.675978Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-03-23T12:38:52.677643Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.23) MySQL Community Server - GPL.
Searching Stackoverflow and other forums I find more suggestions for how to solve similar issues for Linux rather than Windows.
Seems like this also happens when you try to run mysqld --console while the MySQL service is already running (and that instance might be locking the "ibdata1" file).
[InnoDB] The innodb_system data file 'ibdata1' must be writable
The error is clear:
Without being able to write data, MySQL cannot do anything for you.
It can't store your data or passwords if you don't allow MySQL to write to the filesystem, so fix that first and then try the guides on changing the password again.
Try the instruction in the link below:
https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html

Trying to start MySQL from MacOS

I am all new to Iava and JDBC. Probably making a simple mistake. I am trying to start MySQL from NetBeans with the following server properties:
I get the following error messages:
mysqld: Can't change dir to '/usr/local/mysql-8.0.0-dmr-osx10.11-x86_64/data/' (Errcode: 13 - Permission denied)
2020-08-13T10:45:33.948213Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-08-13T10:45:33.948830Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2020-08-13T10:45:33.948973Z 0 [Note] /usr/local/mysql-8.0.0-dmr-osx10.11-x86_64/bin/mysqld (mysqld 8.0.0-dmr) starting as process 29862 ...
2020-08-13T10:45:33.963298Z 0 [Warning] Can't create test file /usr/local/mysql-8.0.0-dmr-osx10.11-x86_64/data/Mauritss-MacBook-Air.lower-test
2020-08-13T10:45:33.963374Z 0 [Warning] Can't create test file /usr/local/mysql-8.0.0-dmr-osx10.11-x86_64/data/Mauritss-MacBook-Air.lower-test
2020-08-13T10:45:33.963913Z 0 [ERROR] failed to set datadir to /usr/local/mysql-8.0.0-dmr-osx10.11-x86_64/data/
2020-08-13T10:45:33.963935Z 0 [ERROR] Aborting
2020-08-13T10:45:33.964020Z 0 [Note] Binlog end
2020-08-13T10:45:33.964169Z 0 [Note] /usr/local/mysql-8.0.0-dmr-osx10.11-x86_64/bin/mysqld: Shutdown complete
I realise I probably have to add some connector but I don't know where and how.

Cannot start MySQL in Linux

Have downloaded MySQL repository through the APT repository, then already did sudo apt-get update and sudo apt-get install mysql-server. But I got the error below:
asus#asus-K40IJ:~$ sudo mysqld
[sudo] password for asus:
2018-11-10T04:34:58.070075Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-10T04:34:58.074324Z 0 [Note] mysqld (mysqld 5.7.24) starting as process 3686 ...
2018-11-10T04:34:58.077869Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2018-11-10T04:34:58.077928Z 0 [ERROR] Aborting
2018-11-10T04:34:58.077959Z 0 [Note] Binlog end
2018-11-10T04:34:58.078047Z 0 [Note] mysqld: Shutdown complete
Why is this and how to solve this..?
It is not recommended to run 'mysqld' as root for security. But you can do it with '--user=root' option.
Please see for more details.
https://dev.mysql.com/doc/refman/8.0/en/security-against-attack.html

Can't install MySQL 5.7 on server without root account

I am using a hosting server that doesn't provide me with a root account.
They don't provide me with an installation service of database.
The server is Red Hat Enterprise Linux Server release 6.1 (Santiago) x86_64.
I tried to download and install MySQL 5.7.10, but it shows me errors regarding to InnoDB setup as below:
[hoge#blackett mysql]$ ./bin/mysqld --initialize --basedir=/home/hoge/mysql --character-set-server=utf8
2016-01-27T14:20:51.751550Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-01-27T14:20:51.751921Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-27T14:20:52.148092Z 0 [Warning] InnoDB: io_setup() failed with EAGAIN. Will make 5 attempts before giving up.
2016-01-27T14:20:52.148146Z 0 [Warning] InnoDB: io_setup() attempt 1.
2016-01-27T14:20:52.658080Z 0 [Warning] InnoDB: io_setup() attempt 2.
2016-01-27T14:20:53.168026Z 0 [Warning] InnoDB: io_setup() attempt 3.
2016-01-27T14:20:53.676057Z 0 [Warning] InnoDB: io_setup() attempt 4.
2016-01-27T14:20:54.181090Z 0 [Warning] InnoDB: io_setup() attempt 5.
2016-01-27T14:20:54.687086Z 0 [ERROR] InnoDB: io_setup() failed with EAGAIN after 5 attempts.
2016-01-27T14:20:54.687174Z 0 [ERROR] InnoDB: Cannot initialize AIO sub-system
2016-01-27T14:20:54.687194Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-01-27T14:20:54.687208Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-01-27T14:20:54.687215Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-01-27T14:20:54.687223Z 0 [ERROR] Failed to initialize plugins.
2016-01-27T14:20:54.687229Z 0 [ERROR] Aborting
I also did the following:
cp ./support-files/my-default.cnf ~/my.cnf
I tried the following command, but it gives me the same errors:
[hoge#blackett mysql]$ ./bin/mysqld --initialize --character-set-server=utf8 --basedir=/home/hoge/mysql --defaults-file=/home/hoge/my.cnf
I wrote the following in my.cnf, but doesn't solve the error:
innodb_use_native_aio = 0
I have no ideas to solve them.
Could you please help me?
Maybe...
On Linux systems, running multiple MySQL servers (typically more than
12) with default settings for innodb_read_io_threads,
innodb_write_io_threads, and the Linux aio-max-nr setting can exceed
system limits. Ideally, increase the aio-max-nr setting; as a
workaround, you might reduce the settings for one or both of the
MySQL configuration options.
-- http://bugs.mysql.com/bug.php?id=61575
I resolved the issue myself.
The document https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html says
the --defaults-file option must be first
When I typed ./bin/mysqld --defaults-file=/home/hoge/my.cnf --initialize --character-set-server=utf8 --basedir=/home/hoge/mysql, the option file was recognized.
Another solution is to specify --innodb_use_native_aio=0 option directly without using the option file, my.cnf, as below:
./bin/mysqld --initialize --basedir=/home/utpsy/mysql --character-set-server=utf8 --innodb_use_native_aio=0

mysql local installation mysql_install_db error

I am working on a *nix machine and I don't have root privileges.
I am trying to install mysql locally using this blogpost: http://www.thedance.net/~roth/TECHBLOG/localMySQL.html
However, I am stuck at scripts/mysql_install_db command.
When I run this command I get the following error:
FATAL ERROR: Neither host 'server.address.com' nor 'localhost' could be looked up with
/usr/bin/resolveip
Please configure the 'hostname' command to return a correct hostname.
If you want to solve this at a later stage, restart this script
with the --force option
On further digging, I found that adding --basedirresolves this issue. But then it generates the following errors:
$scripts/mysql_install_db --basedir=.
Installing MySQL system tables...2015-07-17 01:38:15 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2015-07-17 01:38:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-07-17 01:38:15 0 [Note] ./bin/mysqld (mysqld 5.6.25) starting as process 10281 ...
2015-07-17 01:38:15 10281 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
2015-07-17 01:38:15 10281 [Warning] Can't create test file /var/lib/mysql/head.lower-test
2015-07-17 01:38:15 10281 [Warning] Can't create test file /var/lib/mysql/head.lower-test
./bin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied)
2015-07-17 01:38:15 10281 [ERROR] Aborting
2015-07-17 01:38:15 10281 [Note] Binlog end
2015-07-17 01:38:15 10281 [Note]
When I add --datadir=myDataDir (where myDataDir is a local directory) it generates following error:
$scripts/mysql_install_db --basedir=. --datadir=myDataDir
Installing MySQL system tables...2015-07-17 01:40:54 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2015-07-17 01:40:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-07-17 01:40:54 0 [Note] ./bin/mysqld (mysqld 5.6.25) starting as process 10329 ...
2015-07-17 01:40:54 10329 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
It is trying to access system level folders and because of the permission issues it is failing. How do I install it locally. And how do I setup the hostname?
The problem lies on the following line in log:
[ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
To solve it, add this flag to your command:
--lc-messages-dir="/some/path/you/can/access/without/sudo/"