Results 1 to 3 of 3

Thread: MySQL server admin pass setup

  1. #1
    Join Date
    Jul 2011
    Location
    Čačak, Serbia
    Posts
    80

    Question MySQL server admin pass setup

    Hello,
    I think I did't choose wrong forum of this site to ask this:
    I use OpenSUSE Leap 42.1 KDE. This morning I installed LAMP using YaST Pattern, but I have got problem (for the first time in my life) to setup mysql admin password. I used
    mysqladmin -u root password zzzzzz;
    Result was
    You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'mysqladmin -u root password zzzzzz' at line 1
    What is wrong? How could I set up my MySQL server root (admin) password?

    Thank you in advance

  2. #2

    Default Re: MySQL server admin pass setup

    The error is obvious: what you typed in is no valid SQL statement, mysqladmin is a *shell* command.

    There are several ways to setup an admin password for MySQL/MariaDB, the easiest one is probably running this in a shell:
    Code:
    mysql_secure_installation
    See also https://en.opensuse.org/SDB:MySQL_installation#Securing

    What you tried to use:
    Code:
    mysqladmin -u root password zzzzzz
    should work as well, but you need to type this into the shell, not mysql. I.e. run this *without* running mysql (the client) first.
    Last edited by wolfi323; 16-Jul-2016 at 03:52.

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,487
    Blog Entries
    2

    Default Re: MySQL server admin pass setup

    Nowadays, what you're asking for is a bit easier because MySQL/Mariadb comes with a configuration tool, and setting the mysqladmin password is only one of many required settings to get set up correctly.

    On a new MySQL/Mariadb install, you should run the following script/command which will interactively walk you through the entire process including setting the MySQL Admin password (if you enable remote access)
    Code:
    mysql_secure_installation
    If you want to configure your MySQL/Mariadb security non-interactively (ie as an automated install), IMO scripting the answers as I described in the following Wiki page is easiest because it doesn't require installing new tools

    https://en.opensuse.org/User:Tsu2/MySQL_and_Mariadb

    HTH,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •