> I apologize if this is not the right forum to ask question.
>
> Background
> =========
>
> I am running Ubuntu 12.04 on my laptop. it is the desktop version.
>
> I am aslo running MYSQL server version 5.5.29
>
> I am running into some problems which seem fairly basic and could be
> related to one or both of the following:
>
> 1. It looks like if I specify the "h" flag things work. However, if I use
> "root@localhost", I run into problems.
>
> syedk@syedk-ThinkPad-T410:~$ mysql -uroot -hlocalhost -p mysql
> Enter password:
> Reading table information for completion of table and column names
> You can turn off this feature to get a quicker startup with -A
>
> ********does not work for root@localhost  (for some reason appends
> localhost)
>
> mysql -uroot@localhost -p
> Enter password:
> ERROR 1045 (28000): Access denied for user 'root@localhost'@'localhost'
> (using password: YES)

If you are using mysql to connect to the db on the localhost then this is
not a valid syntax, please read the manual.  mysql is not ssh.  It does
not take the @localhost after the username to connect to a host.  If you
do not specify a -h is assumes that you are connecting to localhost, so it
appends that for you.  That is why you are getting @localhost 2x.

>
> 2.The code that is failing on the install is this.....
>
> #*----------------------------
> -----------------------------
>  #*- Create a database after checking if it exists
>  #*---------------------------------------------------------
>  sub create_db
>  {
>   my ($dbname, $userid, $pass) = @_;
>
>   #*-- check for a duplicate db
>  ----->> my $dbh =
> DBI->connect("DBI:mysql:mysql:localhost:3306","$userid","$pass");
>   my @dbs = $dbh->func('_ListDBs');
>   foreach my $db (@dbs)
>    { if ($db eq $dbname) { $dbh->disconnect(); return(); } }
>
>   #*-- create the db
>   $dbh->do("create database $dbname"); $dbh->disconnect();
>   return();
>  }
>
> The error I am getting is this Line 138 refers to the ---------> line
> above)
>
>
> DBI connect('mysql:localhost:3306'
> ,'root',...) failed: Access
> denied
> for user 'root'@'localhost' (using password: NO) at
> ../TextMine/DbCall.pm line 138
> Can't call method "func" on an undefined value at
> ../TextMine/DbCall.pm line 139.
>
> My mysql may not have all the options loaded?? I loaded DBI but may need
> DBD. Also my databases only have this
>
> mysql> show databases
>     -> ;
> +--------------------+
> | Database           |
> +--------------------+
> | information_schema |
> | test               |
> +--------------------+
> 2 rows in set (0.00 sec)
>

Did you run the mysql_install_db script after installation?  the mysql db
for storing user and database information does not appear to be here. 
Since its not here, you can't connect to it via dbi.  Try specifying test
instead of mysql as the database name in your dsn.

Michael


Reply via email to