Mysql – server running- thesqladmin error- Development Source Tree

MySQLmysqladmin

I'm frustrated!
I have installed mysql using Development Source Tree(version 5.7.5) in Ubuntu 14.04 32-bit.

Starting

  • I started mysql in safe mode using:

    mysqlnew@dpaks:~$ mysqld_safe &
    [1] 4548
    mysqlnew@dpaks:~$ 141024 11:18:58 mysqld_safe Logging to'/usr/local/mysql/data/dpaks.err'.
    141024 11:18:58 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
    

    However, on entering 'mysqladmin version', I get the following error:

    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'deepaks'@'localhost' (using password: NO)'
    
  • If I give a prefix '–skip-grant-tables', mysqladmin starts and gives the following:

    mysqladmin Ver 8.42 Distrib 5.7.5-m15, for Linux on i686

    Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Server version 5.7.5-m15

    Protocol version 10

    Connection Localhost via UNIX socket

    UNIX socket /tmp/mysql.sock

    Uptime: 7 sec

    Threads: 1 Questions: 2 Slow queries: 0 Opens: 84 Flush tables: 1 Open tables: 79 Queries per second avg: 0.285

    So, what is happening with the grants table?

Permissions:

  • For the purpose of running mysql, I created a user as well as a group by the name mysqlnew.
  • My entire installation at /usr/local/mysql is owned by mysqlnew. Permissions
    were set to 777 recursively for the entire directory except for the data directory.
  • Data directory was given 744.
  • my.cnf was set to 755 for user mysqlnew. Its temp file was owned by root.
  • mysql.sock had permissions 777

Server is running? Yes, it is!

Its listed in process status.

mysqlnew  5022  4341  0 12:22 pts/8    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
mysqlnew  5154  5022  3 12:22 pts/8    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/dpaks.err --pid-file=/usr/local/mysql/data/dpaks.pid --socket=/tmp/mysql.sock --port=3306

Also, the netstat command gave me the following:

tcp        0      0 localhost:mysql         *:*                     LISTEN      4680/mysqld

Error Log
The error log says the following:

2014-10-24T05:49:00.835656Z 0 [Note] InnoDB: 5.7.5 started; log sequence number 1296682
2014-10-24T05:49:00.854718Z 0 [Warning] Failed to setup SSL
2014-10-24T05:49:00.854736Z 0 [Warning] SSL error: SSL context is not usable without certificate and private key
2014-10-24T05:49:00.854757Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2014-10-24T05:49:00.854795Z 0 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2014-10-24T05:49:00.864657Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2014-10-24T05:49:01.399455Z 0 [Note] Event Scheduler: Loaded 0 events
2014-10-24T05:49:01.399499Z 0 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.7.5-m15'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution

which means that server is running! Right?

Conf file Following is an excerpt from my my.cnf file located in etc directory:

[client]

port=3306
socket=/tmp/mysql.sock

[mysqld]

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
user = mysql
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock

I also verified that mysql.sock is being created in /tmp directory.

Question: Why am I getting an error when I start mysqladmin without using the prefix '–skip-grant-tables' while the server is running?

Any help would be wholeheartedly appreciated

PS: I have read thoroughly and tried all the solutions given in similar questions here but to no avail.


Update 1

When I gave –skip-grants-table and then when ran 'mysql', its working! But why should I skip it?

Best Answer

OMG! I can't believe I solved it!

I started mysqld. However, client could not be started. When I gave the command 'mysql', the following error was shown:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) mysqlnew@dpaks:/usr/local/mysqlnew/bin$ ./mysql

Why not create a user account in mysql?! Hence, I created a user account 'root' with 'root' as the password by writing the following in a text file named init-file and placing it where the user mysqlnew have access right. Note that they must be in different lines. Also, ensure that the server is not running.

UPDATE mysql.user SET Password=PASSWORD('root') WHERE User='root';
FLUSH PRIVILEGES;

I started the server by:

./mysqld --basedir=/usr/local/mysqlnew --datadir=/usr/local/mysqlnew/data --query_cache_type=1 --init-file=/home/mysqlnew/init-file &

I then started the client by

mysqlnew@dpaks:/usr/local/mysqlnew/bin$ ./mysql -u root -p
Enter password:

Since I have now created a user account in mysql, I don't need to use --skip-grant-tables anymore for starting server.

However, its not yet finished!

mysql> select 1+1;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

So, now I need to rectify this!

mysql> SET PASSWORD = PASSWORD('root');
Query OK, 0 rows affected (0.28 sec)

And that is it! :)