You are not logged in.

#1 2010-12-01 12:13:21

fourreux
Member
Registered: 2008-03-12
Posts: 56

mysql from comman line differs from phpmyadmin

Hi everyone

I'm playing around with mysql and php. I got xampp installed and am starting up with '/opt/lampp/lampp start'. Everything works fine so far and phpadmin works fine. When I'm accessing databases via php it works as expected.

Only: when I'm logging into mysql via command line there's a different story going on. I don't see the databases that are created under phpmyadmin (and vice versa). And when I create a new user via command line it doesn't show in phpmyadmin (and vice versa).

By the way: Also I thought that phpmyadmin would use passwords from mysql. But on command line i'm logging in as root with pwd 'A' via browser I use for 'lampp' as for phpmyadmin 'root' pwd 'B'.

I don't get it and can't find anything on the web - as I, actually, don't really know what to search for.

Any help apreciated - thanx!

PS: On command line I'm doing stuff like:

mysql --user=root -p

mysql> CREATE USER 'avatar'@'localhost' IDENTIFIED BY '@vatar';
Query OK, 0 rows affected (0.07 sec)

mysql> GRANT select,insert,update,delete on my_new_db.* to 'avatar'@'localhost';
Query OK, 0 rows affected (0.03 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW GRANTS FOR 'avatar'@'localhost';
+---------------------------------------------------------------------------------------------------------------+
| Grants for avatar@localhost                                                                                   |
+---------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'avatar'@'localhost' IDENTIFIED BY PASSWORD '*DB961050986B7138420C03732E38042752B5EB0D' |
| GRANT SELECT, INSERT, UPDATE, DELETE ON `my_new_db`.* TO 'avatar'@'localhost'                                 |
+---------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| amarok             |
| mysql              |
+--------------------+
3 rows in set (0.06 sec)

And on phpmyadmin there are databases like:

[...]
information_schema
mysql
phpmyadmin
[...]
etc.

The db for amarok (that I created some time ago via command line) is'nt there.
But I can use the command line commands via phpmydamin (SQL Input field) and that works and shows up in phpmyadmin and not in command line login (again).

It's like two completely different things.

Offline

#2 2010-12-01 21:11:08

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: mysql from comman line differs from phpmyadmin

Is it possible you're running two different MySQL servers?  I know that MySQL has that capability.  I'm not sure what XAMPP does by default, but it may be using its own independent server.

Offline

#3 2010-12-02 13:04:53

fourreux
Member
Registered: 2008-03-12
Posts: 56

Re: mysql from comman line differs from phpmyadmin

That might very well be the case! Thanx.

I got the following processes running: ("ps aux | grep mysql")

root    bin/sh /usr/bin/mysqld_safe --user=mysql
mysql   usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/nox.err --pid-file=/var/lib/mysql/nox.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
root    bin/sh /opt/lampp/bin/mysqld_safe --datadir=/opt/lampp/var/mysql --pid-file=/opt/lampp/var/mysql/nox.pid
nobody  /opt/lampp/sbin/mysqld --basedir=/opt/lampp --datadir=/opt/lampp/var/mysql --user=nobody --log-error=/opt/lampp/var/mysql/nox.err --pid-file=/opt/lampp/var/mysql/nox.pid --socket=/opt/lampp/var/mysql/mysql.sock --port=3306

I also got two my.cnf files in /etc/mysql/my.cnf and in /opt/lampp/etc/my.cnf

So when I login (# mysql -u root -p ) I actually do (/usr/bin/mysql) and get into the first instance. But how can I log into the other one started by lampp?

Btw: Is this really two instances I got here? If i do (mysql> SHOW INSTANCES;) I get an error:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSTANCES' at line 1

Many Thanx

Offline

#4 2010-12-02 13:25:58

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: mysql from comman line differs from phpmyadmin

you have 2 mysqld's running. ergo 2 mysql daemons.
they are configured to run on the same port (which obviously won't work) but they use different unix domain socket files so that does work.

running mysql basically means running a mysqld with a my.cnf (and/or configuring through commandline parameters).  The application doesn't explicitly need to support running it multiple times (although usually you don't want this), and since the instances are separated, they don't know about each other (and there's no reason why they should, unless they replicate between each other or something)


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

Board footer

Powered by FluxBB