| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |
|

07-16-10, 02:29
|
|
Registered User
|
|
Join Date: May 2010
Location: Iowa
Posts: 35
|
|
|
Show Databases
|
|
I am on my MacBook and using MAMP.
If I go into phpMyAdmin (part of the MAMP install) and type "SHOW DATABASES" I see several databases:
- crashcourse (0)
- forum (4)
- information_schema (17)
- myblog (1)
- mydb (0)
- mysql (17)
- sitename (1)
- test (0)
If I go launch the app "mysql" and type "SHOW DATABASES" I only see:
information_schema
test
Why the discrepancy??
The path where the databases seem to be stored is:
Macintosh HD > Applications > MAMP > db > mysql
TomTees
__________________
Helping my wife to start an online business selling T-Shirts.
|
|

07-17-10, 14:02
|
|
Registered User
|
|
Join Date: May 2010
Location: Iowa
Posts: 35
|
|
Could there be an issue with security roles/rights?
Does the "view" I'm seeing in mysql maybe not have the proper rights to see everything create in phpMyAdmin? (I think MAMP logs you in as "root" in phpMyAdmin...)
TomTees
__________________
Helping my wife to start an online business selling T-Shirts.
|
|

07-17-10, 18:48
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 440
|
|
|
|
the root user is default for phpmyadmin and the mysql client. if logged into both as root you would see the same thing. if you are logged into the client as another user you would only see the databases you have been granted permissions on.
|
|

07-18-10, 20:59
|
|
Registered User
|
|
Join Date: May 2010
Location: Iowa
Posts: 35
|
|
Quote:
Originally Posted by guelphdad
the root user is default for phpmyadmin and the mysql client. if logged into both as root you would see the same thing. if you are logged into the client as another user you would only see the databases you have been granted permissions on.
|
Apparently root isn't the default user for the mysql app because I spent quite some time this weekend figuring out what you just said.
It turns out I had to go to the command line prompt and while telling Terminal to open up mysql, to include the switches that allow you to log in as root.
This is what I typed in the Terminal window...
/Applications/MAMP/Library/bin/mysql -u root -p;
When I typed -u root -p; at the mysql> prompt it wasn't working?!
(There should be a way to log in as another user at the mysql> prompt!)
Now that I'm logged in as root, I can indeed see the same tables as phpMyAdmin lists.
TomTees
__________________
Helping my wife to start an online business selling T-Shirts.
|
|

07-18-10, 21:43
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 440
|
|
you can log in as ANY user you have defined the same way as you have done with the root user above.
|
|

07-19-10, 22:58
|
|
Registered User
|
|
Join Date: May 2010
Location: Iowa
Posts: 35
|
|
Quote:
Originally Posted by guelphdad
you can log in as ANY user you have defined the same way as you have done with the root user above.
|
Not when I tried...
Code:
mysql> -u root -p;
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 '-u root -p' at line 1
mysql>
TomTees
__________________
Helping my wife to start an online business selling T-Shirts.
|
|

07-20-10, 11:08
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 440
|
|
well you can't run that from the mysql prompt, you use that when you log in from your shell.
|
|

07-21-10, 01:29
|
|
Registered User
|
|
Join Date: May 2010
Location: Iowa
Posts: 35
|
|
Quote:
Originally Posted by guelphdad
well you can't run that from the mysql prompt, you use that when you log in from your shell.
|
So are you gonna tell me how to switch users and log in as "root" from the mysql> prompt, or do I have to beg??
TomTees
__________________
Helping my wife to start an online business selling T-Shirts.
|
|

07-21-10, 08:18
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
|
|
Quote:
Originally Posted by TomTees
So are you gonna tell me how to switch users and log in as "root" from the mysql> prompt, or do I have to beg?? 
|
No.
-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
|
|

07-21-10, 08:21
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
|
|
Now that I got that opportunity addressed...
You can't get there from here. Once you've logged in from the shell your user is set. The only way to change it is to log in from the shell again.
Once you build a connection to MySQL using any tool I can think of, your user is set. If you need to use more than one MySQL user from a PHP script, then you open more than one MySQL connection to do that.
-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
|
|

07-21-10, 22:58
|
|
Registered User
|
|
Join Date: May 2010
Location: Iowa
Posts: 35
|
|
Quote:
Originally Posted by Pat Phelan
Now that I got that opportunity addressed...
You can't get there from here. Once you've logged in from the shell your user is set. The only way to change it is to log in from the shell again.
Once you build a connection to MySQL using any tool I can think of, your user is set. If you need to use more than one MySQL user from a PHP script, then you open more than one MySQL connection to do that.
-PatP
|
Okay, but that doesn't address my original question...
Apparently mysql doesn't log you in as root like phpMyAdmin does.
I have a shortcut to launch the mysql app and it would be nice to just be logged in as root from there as opposed to have to type in some horribly long string including the path and user and password.
There MUST BE an easier way?!
If not, then screw command-line and I'm going back to phpMyAdmin.
(I just figured it would help me to get comfortable using a raw command-line approach to help keep me honest and focus more on learning SQL and MySQL related commands and less on some GUI that helps you cheat and thus learn less?!)
TomTees
__________________
Helping my wife to start an online business selling T-Shirts.
|
|

07-22-10, 00:53
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
|
|
Write a batch file to invoke with desired parameters, then put the batch file in a folder that is in your PATH ?
-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
|
|

07-22-10, 00:59
|
|
Resident Curmudgeon
|
|
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
|
|
Wait a second, brain fart there... I work in a Windoze environment, and most new users work there too.
In the Mac / Linux environment there are more options, but the concept is the same... Just put the command(s) into a file, flag that file as executable using chmod, and make sure that the file is somewhere that your preferred shell will find it.
-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
|
|

07-22-10, 09:44
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 440
|
|
on phpmyadmin you can use the SQL tab to execute any command you want so you won't just point and click.
Here's a question for you since you seem to be a relatively new user, did you create a password for root and change that setting in phpmyadmin? By default there is no password set for the root user and your system would be completely open to hackers.
Obviously not directly related to the problems that you are having, but wanted to point that out to you since you may not be aware of that.
|
|

07-23-10, 20:58
|
|
Registered User
|
|
Join Date: May 2010
Location: Iowa
Posts: 35
|
|
Quote:
Originally Posted by guelphdad
on phpmyadmin you can use the SQL tab to execute any command you want so you won't just point and click.
|
Is there any learning benefit of using mysql command line over a GUI like phpMyAdmin?
Quote:
Here's a question for you since you seem to be a relatively new user, did you create a password for root and change that setting in phpmyadmin? By default there is no password set for the root user and your system would be completely open to hackers.
Obviously not directly related to the problems that you are having, but wanted to point that out to you since you may not be aware of that.
|
I think MAMP set up MySQL and phpMyAdmin with user=root and password=root
Since I am just working locally, I guess I figured there was no security risk?!
TomTees
__________________
Helping my wife to start an online business selling T-Shirts.
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|