0

I have hosted a website on Strato server. If I want to establish a connection to my MySQL database I get this message: Access denied for user 'user'@'host' to database 'Dbname' . This considers a remote access. I also can't execute simple query in the PHPMyAdmin environment.

select Host, User from mysql.user;

The result of this command is an error:

SELECT command denied to user 'U*******'@'klute.store.d0m.de' for table 'user'

 function __construct()
    {   
        $user =  'U*******';
        $pass = '';
        $database = 'DB*******';
        $host = 'rdbms.strato.de';

        $this->db = new mysqli( $host, $user, $pass, $database);

        if( $this->db->connect_errno > 0 )
            die( $this->db->connect_error );
    }

There must be a way because I already have establishment a connection with Wordpress. So they know how it's done.

mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
Cœur
  • 37,241
  • 25
  • 195
  • 267
melkawakibi
  • 823
  • 2
  • 11
  • 26
  • 1
    Are you sure that the password is the empty string? – PeterMader Jun 04 '17 at 16:15
  • sure your credentials and the dbname are correct? (I suppose you don't show the real ones here..) – Jeff Jun 04 '17 at 16:15
  • I would start be **removing the space** from the database name – RiggsFolly Jun 04 '17 at 16:16
  • I did not include the password for privacy reasons. – melkawakibi Jun 04 '17 at 16:16
  • That space in `' database'` might be breaking it. Note the `' DBName'` part of the error. – Jared Farrish Jun 04 '17 at 16:16
  • This is just dummy data. The real credentials are not included – melkawakibi Jun 04 '17 at 16:17
  • It just that I don't know how to connect to a strato database – melkawakibi Jun 04 '17 at 16:20
  • Possible duplicate of [Access denied for user 'test'@'localhost' (using password: YES) except root user](https://stackoverflow.com/questions/20353402/access-denied-for-user-testlocalhost-using-password-yes-except-root-user) – Matt Clark Jun 04 '17 at 16:21
  • There appear to be other answers, this question has a "solution" edited into it, although it sounds like remote connections may be impacted by server level: https://stackoverflow.com/q/28138413/451969 – Jared Farrish Jun 04 '17 at 16:21
  • @MattClark - The OP is not using localhost, this is most likely not related to those solutions. – Jared Farrish Jun 04 '17 at 16:23
  • The scope of the answer is still valid, in that the user may not be properly setup. The fact that it is localhost vs a remote host is irrelevant. OP would need to change the hostname to that output in the error message, – Matt Clark Jun 04 '17 at 16:24
  • It is entirely relevant to the host's configuration. – Jared Farrish Jun 04 '17 at 16:24
  • @MattClark Yes, I read that a remote acces to the databse is not possible. That's a bit strange? – melkawakibi Jun 04 '17 at 16:25
  • @melkawakibi, If you used something like PhpMyAdmin to create your users, then the default was probably set to localhost. You need to make sure the user that is created has access to login from another host. – Matt Clark Jun 04 '17 at 16:26
  • When I run the command, `select Host from mysql.user where User = 'mclark';` I get the output `%`, this is a wildcard for me to hit my server from any host. – Matt Clark Jun 04 '17 at 16:27

0 Answers0