Koozali.org: home of the SME Server

Connecting to MySQL

CopagJoe

Connecting to MySQL
« on: September 18, 2005, 08:21:36 PM »
I am attempting to install a package that will use MySql. The following script needs the login info for MySql. I tried the server login and I tried "root" with no password - didn't work. Any suggestions?

<?php

/*

######################    CWB  PRO   #######################

############################################################

CWB PRO         $Name: release1_9_8_06012005 $

Revision      $Revision: 1.3 $

Author         $Author: webmaster $

Created 03/01/03        $Date: 2005/01/04 15:19:49 $

Writed by               GraFX (it@grafx.ro)

Scripts Home:           http://www.grafxsoftware.com

############################################################

File purpose            Main configuration file

############################################################

*/

define("DB_USR", "admin");

define("DB_PWD", "union141");

define("DB_NAME", "store");

define("DB_HOST", "localhost");



// define your database informations



define("DB_PREFIX", "cwbs_");

Offline Smitro

  • *
  • 350
  • +0/-0
Connecting to MySQL
« Reply #1 on: September 19, 2005, 01:38:36 AM »
I suggest you try logging in with phpMyAdmin first and setting up a new user with less rights before you go adding into your php scripts.

Try Seaching there is lots of posts from first timers triyng to get into MySQL.
.........

RobRoye

Connecting to MySQL
« Reply #2 on: September 22, 2005, 08:30:41 AM »
To use MySQL for the first time you have to do one very simple command. Manually set the password. From the root prompt, type: mysqladmin password yourpasswordhere

After you type it, it should just give you another command prompt without any result being displayed. This is normal. Try to log into MySQL and and just do a show databases command to test it.

Code: [Select]
mysql -uroot -pEnter the password when prompted.

If you are able to log it, it works fine, but type: show databases; just to be sure. Don't forget the semicolon at the end! After it works, just type exit to log out of MySQL (be sure to do this) and the web app should be fine.

Offline gregswallow

  • *
  • 651
  • +1/-0
Connecting to MySQL
« Reply #3 on: September 22, 2005, 09:31:21 AM »
RobRoye - your advice is not good.  mysql already has a root password set, and you don't need to (and shouldn't) change it.

phpmyadmin is easy to use without knowing mysql and easy to install on SME and you can create a database and a username/password just for that database with only SELECT, INSERT, DELETE and UPDATE permissions on that specific database, which is probably all the software needs.

Install phpmyadmin for SME6:
rpm -ivh http://mirror.contribs.org/smeserver/contribs/nightspirit/e-smith-phpmyadmin/e-smith-phpmyadmin-2.6.0-12.noarch.rpm

...and access at:
https://yourdomain.com/phpmyadmin

RobRoye

Connecting to MySQL
« Reply #4 on: September 22, 2005, 08:53:54 PM »
phpmyadmin is perfectly fine to use if one wishes to go that route. Most people simply want one thing to run and this is how it is frequently done. My advice was not bad at all, it was simply different from yours. It does not change the password at all if you use the same password you had set during install. Web apps are unable to connect to the database until at least one password is set - either using mysqladmin or phpmyadmin. Both work.

I use phpmyadmin on several machines, as well as other web-based management and utility apps, so you are correct in recommending it - I was simply making known an alternate method.

Offline gregswallow

  • *
  • 651
  • +1/-0
Connecting to MySQL
« Reply #5 on: September 22, 2005, 09:54:45 PM »
Quote from: "RobRoye"
My advice was not bad at all, it was simply different from yours.


I disagree.  Your advice in setting a password might be fine for a generic Redhat system, but SME has set the mysql root password already, it is done when you install SME, and it is saved so there isn't a need to remember it.  The root password that is set is stored in /root/.my.cnf.  Check for yourself.

Quote from: "RobRoye"
phpmyadmin is perfectly fine to use if one wishes to go that route. Most people simply want one thing to run and this is how it is frequently done.


You are advising him to use the root account for his web app, that's not good advice either.  If you want to give some good alternative advice on how to create a new database, and a user and password for that database with limited priveleges, all from the command line, go for it.

RobRoye

Connecting to MySQL
« Reply #6 on: September 24, 2005, 07:09:12 AM »
Well, we can just agree to disagree.  :-)