Re: Can't connect to local host MySQL database
"Vance E. Neff" <[email protected]> Sun, 29 Mar 2009 11:04:16 -0400
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Organization | Vance's Consulting Co. |
| Message-ID | <[email protected]> |
Hans,
Thank you for your response!
I tried:
CREATE USER 'CNCJobs'@'%' IDENTIFIED BY '1a2b3c';
GRANT ALL PRIVILEGES ON *.* TO 'CNCJobs'@'%' WITH GRANT OPTION;
adn then:
our $dbh =
DBI->connect("dbi:mysql:database=test;host=localhost;port=3306","CNCJobs","1a2b3c")
|| die "could not open CNCJobs.MySQL database! $DBI::errstr";
I then tried:
CREATE USER 'CNCJobs'@'localhost' IDENTIFIED BY '1a2b3c';
GRANT ALL PRIVILEGES ON *.* TO 'CNCJobs'@'localhost' WITH GRANT OPTION;
and then:
our $dbh =
DBI->connect("dbi:mysql:database=test;host=localhost;port=3306","CNCJobs","1a2b3c")
|| die "could not open CNCJobs.MySQL database! $DBI::errstr";
and finally I tried (your original suggestion):
GRANT SELECT ON test.* TO testuser@localhost IDENTIFIED BY '1a2b3c';
and then:
our $dbh =
DBI->connect("dbi:mysql:database=test;host=localhost;port=3306","testuser","1a2b3c")
|| die "could not open CNCJobs.MySQL database! $DBI::errstr";
and also:
our $dbh =
DBI->connect("DBI:mysql:database=test;host=localhost;port=3306","CNCJobs","1a2b3c")
|| die "could not open CNCJobs.MySQL database! $DBI::errstr";
The change in the last attempt was just capitalizing DBI in "dbi:mysql...".
I got the same (and the original) error on all three (four) attempts.
Is there a log that would show connection attempts to a MySQL database?
The Apache error log indicated the same error message, so no help there.
Thanks again for your response!
Vance
Hans Ginzel wrote:
> Do you realy use an empty password for the root account?
>
> Log to your db as root from commandline;
> create user:
> GRANT SELECT ON tets.* TO new_user@localhost IDENTIFIED BY
> 'some_pass'
>
> http://dev.mysql.com/doc/refman/5.1/en/adding-users.html
>
> and try connect
>
> DBI->connect("dbi:mysql:database=test;host=localhost;port=3306","new_user","some_pass")
> or die "Could not open CNCJobs.MySQL database: $DBI::errstr";
>
> Hans
>
>
> On Sat, Mar 28, 2009 at 10:18:49AM -0400, Vance E. Neff wrote:
>
>> Hello,
>>
>> I'm having trouble connecting to my MySQL database on a Windows XP SP2
>> system via Perl.
>>
>> use DBI;
>> use DBD::mysql;
>>
>> Can't connect to MySQL server on 'localhost' (10061) at ... this statement:
>> our $dbh =
>> DBI->connect("dbi:mysql:database=test;host=localhost;port=3306","root","")
>> || die "could not open CNCJobs.MySQL database! $DBI::errstr";
>>
>> Note that the above line probably wrapped.
>>
>> Version info:
>> perl version v5.10.0 built for MSWin32-x86-mulit-thread by ActiveState
>> MySQL Server version: 5.1.32-community
>> DBI::VERSION = 1.607
>> DBD::mysql::VERSION = 4.005
>>
>> I am able to use the MySQL Command line statement:
>> mysql -u root -h localhost test.
>> and can successfully use a select query on the database.
>>
>> Any ideas?
>>
>> Vance
>>
>>
>> --
>> MySQL Perl Mailing List
>> For list archives: http://lists.mysql.com/perl
>> To unsubscribe: http://lists.mysql.com/[email protected]
>>
>
>
>
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]