Koozali.org: home of the SME Server
Obsolete Releases => SME Server 7.x => Topic started by: MasthaX on May 07, 2007, 08:25:19 PM
-
Im getting acces denied when i try to use MYSQL from command prompt when i start mysql and run query's it works. I cant connect to mysql with PHP because root doesnt have access it says.
#mysql
// welcome mysql blablaba
-> CREATE TABLE `users`;
works
but
#mysql -h localhost -u root -p samp_db < ~/data/query.sql
this doesnt work. When i do this it asks for a password. I know root hasnt got a standard password so if i just press enter it says acces denied. When i enter my root password it says access denied again. So how can i solve this?
-
So how can i solve this?
Have a read of this...
http://wiki.contribs.org/MySQL#Login_as_MySQL_root_user
-
i did, but still without any luck.
FE i cant log into phpmyadmin
When i use root without password it doenst work.
When i use root with my normal root password it doesnt work.
When i use admin with admin/root password it doenst work.
-
Somebody is missing the point here...
I quote from the reference given to you:
Login as MySQL root user
To login as MySQL root user, simply type 'mysql' at the SME Server shell, this will log you in with root privileges.
-
As described by Confucius and Byte, if you try 'logging in' to MySQL as root rather than 'logging in' to your server as root and then 'entering' MySQL, you run the risk of changing your root password for MySQL which creates it's own bit of fun ;-)
Craig
-
I can access it by shell just cant access it from outside of the shell. FE in my PHP pages.
-
In your PHP pages you need to create/use a db script to access mysql with a 'non-root' user (one you already created)
You DON'T want to use 'root' to access databases in your PHP. Create a non-root user in mysql and grant permissions.
Most apps have a 'config.inc.php' or some similar script which allows setting up your db connection settings.
create the db:
mysqladmin create mydatabase
enter mysql:
[root@station70 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3040 to server version: 4.1.20
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
grant permissions:
mysql> grant all on mydatabase.* to nonrootuser@localhost identified by '3d0JYcSoyT4ogrvsMYP19OylGXze/odfjPajCMFl098WDiq';
where mydatabase is the db, nonrootuser is the user, and the string between '' is the password.
Craig
-
Thankyou this worked for me! :lol: