On Mon, 14 Dec 2020 10:01:15 +0100
deloptes <delop...@gmail.com> wrote:

> Keith Christian wrote:
> 
> > Next, I logged in with this:
> > mysql -u root -p
> > 
> > But as I remembered, (it's been awhile) one cannot create any users
> > in this mode due to --skip-grant-tables.  
> 
> When installed in Debian it does not have password (AFAIR). It is
> sufficient to execute "mysql -u root -p" and press ENTER to log in.
> You then change the password.
> 
> Regarding --skip-grant-tables I used this just last week to reset a
> root password for a customer.
> It seems there are two different methods depending on what version
> you use.
> 
> > but I can't log in with either user after restarting MariaDB with:
> > sudo systemctl start mariadb
> >   
> 
> Could be that you have something on the network side? From which host
> do you log in?
> 
> > Seems I must always log in with
> > mysql -u root -p
> >   
> 
> This is working only on localhost
> 
> > There are lots of web pages mentioning this problem but none are
> > complete enough and my attempts have failed.
> > 
> > SO.....Looking for a "bulletproof" document to set up MariaDB users
> > so I can get on with configuring Mediawiki.
> >   
> 
> Just try 
>         mysql -u root -p -h localhost
> 
> > I don't want to login as a 'root'@'localhost' user for routine DB
> > work and would rather use the 'mediawiki'@localhost' user for that.
> >  
> So
>         mysql -u mediawiki -p -h localhost
> is not working as well?
> 
> I use following and never had issue with that
> 
> CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY 'xxxxxxxxxxx';
> GRANT Select ,Insert ,Update ,Delete ,Create ,Drop , Index ,Alter  ON
> mediawiki.* TO 'mediawiki'@'localhost';
> flush privileges;
> 
> Remember the client can access only on local host.
> 
You don't even need the CREATE USER.

You can GRANT xxxxxxxx TO 'fred'@'localhost' IDENTIFIED BY 'yyyyyyy'
which will create user and privileges at the same time.

Remember that modern versions of MySQL/MariaDB will not allow logging
in as root unless you are already logged in to the terminal as operating
system root. This means that phpmyadmin, if you use it, cannot login to
the database root account, and you need a differently-named account with
all privileges, including GRANT.

-- 
Joe

Reply via email to