0

maybe I'm just missing something very obvious but I can't somehow connect to my mysql database which is installed on my local computer. When I open mysql.exe it says I'm connected to MariaDB and an ID. But when I try to access a certain database I get: "ERROR 1044 (42000): Access denied for user ''@'localhost' to database ..."

When I check for status, it says I'm connected as a user that has the name of my computer @localhost.

Hope someone can help. :)

2
  • first' How to connect with command line ? second` the correct way to connect with database base by command line is get the path of mysql ->bin on xampp and copy path in properties on command line start in your path and open command line connect with database mysql -u your username -p your password if don't have any password don't write thing Commented Oct 31, 2017 at 15:08
  • I'm using mysql.exe which is in C:\xampp\mysql\bin this is what i get: image.ibb.co/mXWe2b/cantlogin.jpg Commented Oct 31, 2017 at 15:16

3 Answers 3

1

I guess xampp somehow blocks using mysql.exe for login purposes or something. When i use the shell from the xampp control panel, everything works fine. But I'm not sure on this.

Sign up to request clarification or add additional context in comments.

Comments

0

MariaDB is a "drop in replacement" for MySQL, hence the name confusion. (This is not a problem, just a confusion.) (And there are subtle differences between MySQL and MariaDB, but you are nowhere near to them.)

When you installed XAMPP, a user named "root" was established for MariaDB. And perhaps it asked for a password?? If you have not yet GRANTed any other "users" to get to the database, then "root" is the "user" to use.

The commandline tool mysql should also be available. But it, too, needs a valid user and password:

mysql -u root      -- if no password
mysql -u root -p   -- it will then prompt for the password

If you are connecting from a different machine, you need more arguments and will need to have GRANTed access from that machine via the @... part of the GRANT statement.

Comments

0

Example of connecting directly to db named iluminati:

tenasimi@SANTRALSUM-05 c:\xampp
# mysql -u root -p iluminati
Enter password: *
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 806
Server version: 5.6.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.6.24, for Win32 (x86)

Connection id:          806
Current database:       iluminati
Current user:           root@localhost
SSL:                    Not in use
Using delimiter:        ;
Server version:         5.6.24 MySQL Community Server (GPL)
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    cp866
Conn.  characterset:    cp866
TCP port:               3306
Uptime:                 1 day 2 hours 4 min 58 sec

Threads: 1  Questions: 2476  Slow queries: 0  Opens: 78  Flush tables: 1  Open
ables: 71  Queries per second avg: 0.026
--------------

mysql> show tables;
+---------------------+
| Tables_in_iluminati |
+---------------------+
| dutypersons         |
| persons             |
| products            |
+---------------------+
3 rows in set (0.00 sec)

mysql> exit;
Bye

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.