[SOLVED] MySQL - unrecognized option: i
[SOLVED] MySQL - unrecognized option: i
Trying to setup MySql on bionic64 8.0 and I'm having trouble getting it started.
"/etc/init.d/mysql start" keeps failing with "unrecognized option: i" message.
Been trying to search for a solution online for 2 days and could.not find anything related to the problem. I don't see any log files as well under /var/log
Any clues?
"/etc/init.d/mysql start" keeps failing with "unrecognized option: i" message.
Been trying to search for a solution online for 2 days and could.not find anything related to the problem. I don't see any log files as well under /var/log
Any clues?
Last edited by jp734 on Sun 21 Jun 2020, 03:25, edited 1 time in total.
Hello jp734,
Yes. Here is the fix for the error. But first please try on a terminal:
if there is a complaint about starting as root try:
To fix: open /etc/init.d/mysql in geany
Around line 26 look for ->
change
to
Check for what line 26 is looking for: /etc/mysql/debian.cnf
if it is missing create it and copy and paste the code below into it and save. Check to match user and password to your machine
/etc/mysql/debian.cnf
then try:
Yes. Here is the fix for the error. But first please try on a terminal:
Code: Select all
mysqld
Code: Select all
mysqld -u root
Around line 26 look for ->
Code: Select all
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# priority can be overridden and "-s" adds output to stderr
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
Code: Select all
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
Code: Select all
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql"
if it is missing create it and copy and paste the code below into it and save. Check to match user and password to your machine
/etc/mysql/debian.cnf
Code: Select all
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = root
password = admin
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password = admin
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
Code: Select all
etc/init.d/mysql start
rockedge - thank you for the reply
I went ahead and edited /etc/init.d/mysql and created /etc/mysql/debian.cnf but everytime I run mysqld, I get an error "mysqld: /usr/lib64/libssl.so.1.1; version 'OPENSSL_1_1_1' not found (requred by mysqld)
I'll see what I can do upgrading this when i get a chance.
I went ahead and edited /etc/init.d/mysql and created /etc/mysql/debian.cnf but everytime I run mysqld, I get an error "mysqld: /usr/lib64/libssl.so.1.1; version 'OPENSSL_1_1_1' not found (requred by mysqld)
I'll see what I can do upgrading this when i get a chance.
PPM shows 'openssl_1.1.1 as ALREADY INSTALLED' but also a window pops up saying 'found package: openssl_1.1.1 and installed package: openssl_1.1.0g'
'openssl version' command confirms version 'openssl_1.1.0g 2 Nov 2017'. Reinstalling openssl_1.1.1 from PPM doesn't work. How do you install it properly?
I did cheat (don't worry, I made a backup) by getting a copy of 'libssl.so.1.1' and 'libcrypto.so.1.1' from another computer with ubuntu 20.04 and that seem to solve the issue with openssl version. I am now getting:
'openssl version' command confirms version 'openssl_1.1.0g 2 Nov 2017'. Reinstalling openssl_1.1.1 from PPM doesn't work. How do you install it properly?
I did cheat (don't worry, I made a backup) by getting a copy of 'libssl.so.1.1' and 'libcrypto.so.1.1' from another computer with ubuntu 20.04 and that seem to solve the issue with openssl version. I am now getting:
but MySQL still fails to start. Error log shows some warnings and errorsOpenSSL 1.1.1 11 Sep 2018 (Library: OpenSSL 1.1.1f 31 Mar 2020)
but of course 'mysql_upgrade' command will not work since mysql fails to start.2020-06-18T14:58:32.317550Z 0 [Warning] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.
.
.
mysqld: Table 'mysql.plugin' doesn't exist
2020-06-18T14:58:32.412542Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Here is how to install a mysql server using mariaDB. It is easy in Bionic64.
Method 1 (using a script utilizing Pkg)
the user = root password = admin
Each step of the script can be done manually in a terminal
To test, in a terminal :
Method 2 (via PPM)
Open PPM and update
in PPM search for "mariadb" or "maria-server". The point is find mariadb-server_10.1.44 and install it.
in a terminal :
To test, in a terminal :
ctrl-d to quit
will you need help with phpMyAdmin?
Method 1 (using a script utilizing Pkg)
Code: Select all
#!/bin/sh
# # create the user for the mysql server
adduser mysql -D
#update repos
pkg repo-update
# install the mysql server and intialize it
pkg add mariadb mariadb-server
# create run time directories and set the correct permissions and ownership
[ ! -d /var/run/mysqld ] && mkdir /var/run/mysqld
[ ! -d /var/run/mysqld ] && mkdir /var/log/mysql
chown -R mysql /var/run/mysqld
chown -R mysql /var/log/mysql
mysql_install_db
sleep 2
mysqld &
sleep 2
echo "Make sure that NOBODY can access the server without a password"
# Make sure that NOBODY can access the server without a password
mysql -e "UPDATE mysql.user SET /var/log/mysqlPassword = PASSWORD('admin') WHERE User = 'root'"
# Kill the anonymous users
mysql -e "DROP USER ''@'localhost'"
# Because our hostname varies we'll use some Bash magic here.
mysql -e "DROP USER ''@'$(hostname)'"
# Make our changes take effect
mysql -e "FLUSH PRIVILEGES"
echo "Finished stage 1. mariadb is installed"
Each step of the script can be done manually in a terminal
To test, in a terminal :
Code: Select all
mysql -uroot -padmin
Method 2 (via PPM)
Open PPM and update
in PPM search for "mariadb" or "maria-server". The point is find mariadb-server_10.1.44 and install it.
in a terminal :
Code: Select all
adduser mysql -D
mkdir /var/run/mysqld
mkdir /var/log/mysql
chown -R mysql /var/run/mysqld
chown -R mysql /var/log/mysql
mysql_install_db
mysqld &
/usr/bin/mysql_secure_installation
Code: Select all
mysql -uroot -padmin
ctrl-d to quit
will you need help with phpMyAdmin?
Last edited by rockedge on Fri 19 Jun 2020, 05:43, edited 1 time in total.
If trying to get the installation of MySQL to start without removing it and replacing with mariaDB you need to initialize MySQLmysqld: Table 'mysql.plugin' doesn't exist
2020-06-18T14:58:32.412542Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Code: Select all
mysqld --initialize --user=mysql
check that /var/log/mysql exists and is owned by user mysql
Once it is initialized, set up security by setting a password for root in a terminal:
Code: Select all
/usr/bin/mysql_secure_installation
Code: Select all
mysql
*
@rockedge
mysqld --initialize --user=mysql gives me:
If I use "--explicit_defaults_for_timestamp", I get the same error log only without the comment about timestamp.
Is the data directory it is referring to "/var/lib/mysql"? Files in the folder are: ib_buffer_pool, ibdata1, ib_logfile0 and ib_logfile1. My guess is the program created those files coz I don't remember copying them
I'll try mariadb next time if you think that will be easier to setup. My apache2 and php seem to be working just fine. html and php script test files shows up just fine on my browser. It's the database server and ssl that I have yet to test, but I'll let you know if I need help later on. This little project of mine is for nextcloud.
Thanks again
mysqld --initialize --user=mysql gives me:
Code: Select all
2020-06-19T17:12:20.371124Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-06-19T17:12:20.372653Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2020-06-19T17:12:20.372675Z 0 [ERROR] Aborting
Is the data directory it is referring to "/var/lib/mysql"? Files in the folder are: ib_buffer_pool, ibdata1, ib_logfile0 and ib_logfile1. My guess is the program created those files coz I don't remember copying them
I'll try mariadb next time if you think that will be easier to setup. My apache2 and php seem to be working just fine. html and php script test files shows up just fine on my browser. It's the database server and ssl that I have yet to test, but I'll let you know if I need help later on. This little project of mine is for nextcloud.
Thanks again
Hello jp734,
Sounds like you are very close to success! I would say set up mariaDB it's just easier these days.
Any help I can give.
I think you need to delete that entire /var/lib/mysql directory THEN run
Sounds like you are very close to success! I would say set up mariaDB it's just easier these days.
Any help I can give.
I think you need to delete that entire /var/lib/mysql directory THEN run
Code: Select all
mysqld --initialize --user=mysql
I found this online, apparently what solved their mysql.plugin missing error but not sure exactly where to place it.
from: https://forums.mysql.com/read.php?20,64 ... msg-644661
Also, if I decide to use mariadb, will I have to uninstall mysql?
from: https://forums.mysql.com/read.php?20,64 ... msg-644661
Code: Select all
> placing "--defaults-file=" option at the first place ahead of all the other options
Finally able to get MySQL started.
- Delete all files from /var/lib/mysql
- run "mysqld --defaults_file= --initialize --explicit_defaults_for_timestamp
The '--defaults_file=' option not only created the four files I deleted from /var/lib/mysql folder but added ten extra files that included certificate and key .pem files plus 3 folders (mysql, performance_schema and sys). Under mysql folder are 75 items including the missing plugin files (plugin.ibd and plugin.frm)
A couple more issues after this. MySql's 'my.cnf' configuration file have typo errors. One is the 'key_buffer=16M' and the other is 'myisam-recover=BACKUP'. They needed to be changed to 'key_buffer_size=16M' and 'myisam-recover_options=BACKUP'. I found it here https://dev.mysql.com/doc/refman/5.7/en ... start.html
MySql now starts ok BUT when I enter "mysql -u root -p", I get "Access denied for user 'root'@'localhost'
I believe once I figure this one out, there will be no more hiccups. (for mysql setup at least. Setting up nextcloud is another question)
- Delete all files from /var/lib/mysql
- run "mysqld --defaults_file= --initialize --explicit_defaults_for_timestamp
The '--defaults_file=' option not only created the four files I deleted from /var/lib/mysql folder but added ten extra files that included certificate and key .pem files plus 3 folders (mysql, performance_schema and sys). Under mysql folder are 75 items including the missing plugin files (plugin.ibd and plugin.frm)
A couple more issues after this. MySql's 'my.cnf' configuration file have typo errors. One is the 'key_buffer=16M' and the other is 'myisam-recover=BACKUP'. They needed to be changed to 'key_buffer_size=16M' and 'myisam-recover_options=BACKUP'. I found it here https://dev.mysql.com/doc/refman/5.7/en ... start.html
MySql now starts ok BUT when I enter "mysql -u root -p", I get "Access denied for user 'root'@'localhost'
I believe once I figure this one out, there will be no more hiccups. (for mysql setup at least. Setting up nextcloud is another question)
So 'mysqld --initialize' command will generate a temporary password for root and it will be listed on error.log, but even using the temporary password will not work for me.
How I got it to work is deleting all the files again from /var/lib/mysql and this time running 'mysqld --initialize-insecure'.
Finally was able to login with: 'mysql -u root --skip-password'
and then ALTER USER 'root'@'localhost' IDENTIFIED BY 'new-root-password'; to create a root password for security.
One thing I noticed though. Checking status of mysql says it is stopped even though it is clearly running and I can log in.
How I got it to work is deleting all the files again from /var/lib/mysql and this time running 'mysqld --initialize-insecure'.
Finally was able to login with: 'mysql -u root --skip-password'
and then ALTER USER 'root'@'localhost' IDENTIFIED BY 'new-root-password'; to create a root password for security.
One thing I noticed though. Checking status of mysql says it is stopped even though it is clearly running and I can log in.