[SOLVED] MySQL - unrecognized option: i

Using applications, configuring, problems
Post Reply
Message
Author
jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

[SOLVED] MySQL - unrecognized option: i

#1 Post by jp734 »

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?
Last edited by jp734 on Sun 21 Jun 2020, 03:25, edited 1 time in total.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#2 Post by Semme »

Wrong tree. Sorry.
Last edited by Semme on Wed 17 Jun 2020, 23:54, edited 1 time in total.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#3 Post by Semme »

Withdrawn.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#4 Post by rockedge »

Hello jp734,

Yes. Here is the fix for the error. But first please try on a terminal:

Code: Select all

mysqld
if there is a complaint about starting as root try:

Code: Select all

mysqld -u root
To fix: open /etc/init.d/mysql in geany
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"
change

Code: Select all

ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
to

Code: Select all

ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql"
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

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
then try:

Code: Select all

etc/init.d/mysql start

jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

#5 Post by jp734 »

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.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#6 Post by Semme »

There are security upgrades for both openssl & libssl that should iron things out.
root# openssl version
OpenSSL 1.1.0g 2 Nov 2017
root# openssl version
OpenSSL 1.1.1 11 Sep 2018
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

#7 Post by jp734 »

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 1.1.1 11 Sep 2018 (Library: OpenSSL 1.1.1f 31 Mar 2020)
but MySQL still fails to start. Error log shows some warnings and errors
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.
but of course 'mysql_upgrade' command will not work since mysql fails to start.

jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

#8 Post by jp734 »

FYI. - Placing back the original libssl.so.1.1 and libcripto.so.1.1 results an "openssl_1_1_1 not found" when I execute "openssl version". This is after I tried to install OPENSSL.1.1.1 from PPM

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#9 Post by Semme »

Was "mysql-server-core-5.7" the initial pkg you choose when you installed MySQL? PPM lists pkg installs chronologically.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

#10 Post by jp734 »

Yes. These are the ones installed.

mysql-server-core-5.7_5.7.30
mysql-client-5.7_5.7.30
mysql-client-core-5.7_5.7.30
mysql-common_5.8+1.0.4 (not sure why the version is different but ppm doesn't show any other choices)
mysql-server-5.7_5.7.30
mysql-server-5.7.30

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#11 Post by rockedge »

Here is how to install a mysql server using mariaDB. It is easy in Bionic64.

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"
the user = root password = admin
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
To test, in a terminal :

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.

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#12 Post by rockedge »

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.
If trying to get the installation of MySQL to start without removing it and replacing with mariaDB you need to initialize MySQL

Code: Select all

mysqld --initialize --user=mysql
check that /var/run/mysqld exists and is owned by 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 
Test in a terminal with

Code: Select all

mysql
ctrl-d to quit

*

jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

#13 Post by jp734 »

@rockedge

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
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

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#14 Post by rockedge »

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

Code: Select all

mysqld --initialize --user=mysql

jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

#15 Post by jp734 »

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

Code: Select all

 > placing "--defaults-file=" option at the first place ahead of all the other options 
Also, if I decide to use mariadb, will I have to uninstall mysql?

jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

#16 Post by jp734 »

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)

jp734
Posts: 119
Joined: Sat 29 Mar 2014, 17:59

#17 Post by jp734 »

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.

Post Reply