473,765 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DBI with mysqld

Hi everybody.

Can I use DBI to interface Perl with mysqld running locally rather than
with a 'true' MySQL server?

If not DBI, how can I do this?

aTdHvAaNnKcSe

--
JAY VOLLMER
JV******@VISI.C OM
Aug 7 '05 #1
5 1939
Jay Vollmer (jv******@visi. com) wrote:
: Hi everybody.

: Can I use DBI to interface Perl with mysqld running locally rather than
: with a 'true' MySQL server?

: If not DBI, how can I do this?

All modern computer systems are capable of being "servers" (though some
OS's are crippled on purpose to force you to buy a more expensive "server"
versions).

If you have a mysql database installed and the mysql processes running on
your local computer then your local computer is the mysql server.

In that case you can use DBI (with perl) to access the database. Just use
"localhost" as the server name.

If you mean that you have database _files_ but aren't running the mysql
processes then I don't know of any tool to access the database tables,
though data dump tools may exist (but I doubt they would allow you to do
updates or "normal" queries).

I suspect you are just confused. Normally a mysql installation will
include files containing data and programs that are started when the
computer is booted that are the processes with which you can communicate
to access the data. You can use the mysql client program, or DBI (in
perl) or various other libraries with other languages to talk to the
processes so as to access the data.

--

This space not for rent.
Aug 7 '05 #2
On Sat, 06 Aug 2005 21:28:00 -0800, Malcolm Dew-Jones wrote:
Jay Vollmer (jv******@visi. com) wrote:
: Hi everybody.

: Can I use DBI to interface Perl with mysqld running locally rather than
: with a 'true' MySQL server?

: If not DBI, how can I do this? If you have a mysql database installed and the mysql processes running on
your local computer then your local computer is the mysql server.

In that case you can use DBI (with perl) to access the database. Just use
"localhost" as the server name.


Thanks for the reply. In answer; I tried using localhost, but it doesn't
work.

--
JAY VOLLMER
JV******@VISI.C OM
Aug 7 '05 #3
Jay Vollmer (jv******@visi. com) wrote:
: On Sat, 06 Aug 2005 21:28:00 -0800, Malcolm Dew-Jones wrote:

: > Jay Vollmer (jv******@visi. com) wrote:
: > : Hi everybody.
: >
: > : Can I use DBI to interface Perl with mysqld running locally rather than
: > : with a 'true' MySQL server?
: >
: > : If not DBI, how can I do this?

: > If you have a mysql database installed and the mysql processes running on
: > your local computer then your local computer is the mysql server.
: >
: > In that case you can use DBI (with perl) to access the database. Just use
: > "localhost" as the server name.

: Thanks for the reply. In answer; I tried using localhost, but it doesn't
: work.

"it doesn't work." is not a good enough description. Many things could be
wrong. At a minimum you need to tell us the exact error message and error
code, and also show us a minimal script that doesn't work.

--

This space not for rent.
Aug 7 '05 #4
On Sat, 06 Aug 2005 23:19:55 -0800, Malcolm Dew-Jones wrote:
Jay Vollmer (jv******@visi. com) wrote:
: On Sat, 06 Aug 2005 21:28:00 -0800, Malcolm Dew-Jones wrote:

: > Jay Vollmer (jv******@visi. com) wrote:
: > : Hi everybody.
: >
: > : Can I use DBI to interface Perl with mysqld running locally rather than
: > : with a 'true' MySQL server?
: >
: > : If not DBI, how can I do this?

: > If you have a mysql database installed and the mysql processes running on
: > your local computer then your local computer is the mysql server.
: >
: > In that case you can use DBI (with perl) to access the database. Just use
: > "localhost" as the server name. "it doesn't work." is not a good enough description. Many things could be
wrong. At a minimum you need to tell us the exact error message and error
code, and also show us a minimal script that doesn't work.


Here is an example of the code:

#!/usr/bin/perl
use DBI;
$drh = DBI->install_driver ( 'mysql' );
$dbh = DBI->connect("DBI:m ysql:test:", 'username', 'password');
die "Cannot connect: $D: $DBI::errstr\n" unless $dbh;

$sth = $dbh->prepare("selec t * from test;");
$sth->execute;
while (($first_name, $field1, $field2, $field3) = $sth->fetchrow)
{
#Do something here;
}

I get the following error:

DBI connect('test:l ocalhost','jvol lmer',...) failed: Access denied for
user:
'jvollmer@local host' (Using password: YES) at ./testsql.pl line 4
Cannot connect: : Access denied for user: 'jvollmer@local host' (Using
password: YES)

But I have no trouble accessing the database using the mysql client.

Okay, that's the exaple and the error. I fixed it by removing the
servername, login and password entirely. It works if I do this:

$dbh = DBI->connect("DBI:m ysql:test:");

Thanks for your time anyway.

--
JAY VOLLMER
JV******@VISI.C OM
Aug 7 '05 #5
Jay Vollmer wrote:
DBI connect('test:l ocalhost','jvol lmer',...) failed: Access denied for
user:
'jvollmer@local host' (Using password: YES) at ./testsql.pl line 4
Cannot connect: : Access denied for user: 'jvollmer@local host' (Using
password: YES)

But I have no trouble accessing the database using the mysql client.
I assume when it works with the mysql client, you are not specifying the
username and password. You'd probably get the same error above if you
did this:

C:> mysql -u jvollmer -p test
Password:
(and enter your password when prompted)
Okay, that's the exaple and the error. I fixed it by removing the
servername, login and password entirely. It works if I do this:

$dbh = DBI->connect("DBI:m ysql:test:");

Thanks for your time anyway.


I'm glad it's working. For what it's worth, we can explain why you got
that error, it might help you in the future.

You had the database on your local system, and the MySQL service
running, but you hadn't granted access to the database for user jvollmer
when he connects using the password you entered.

You can set up a new user account by using the 'mysql' database and
running this statement:

mysql> grant all on test.* to 'jvollmer'@'loc alhost' identified by
'password';
(substitute the password you want in place of 'password', of course)

See http://dev.mysql.com/doc/mysql/en/adding-users.html for further
reading on this topic.

Regards,
Bill K.
Aug 7 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
7531
by: Stephane Raimbault | last post by:
I've been searching the mailing list for a solution to my problem with "mysqld got signal 11;" and I haven't seen any answers that might help me. This is the situation. I have a db that is being accessed intensively about 400 connections during the wee at a time. I noticed the problem at first with 4.0.13 and tried 3.23.57 and now 4.0.14 with the same problem. I've run the db on FreeBSD 5.1 and 4.8, again same problem. This is what...
0
2196
by: Maciej Wiznerowicz | last post by:
Dear Sirs, I can not start MySQL server. More specifically, MySQL was running fine all the time since installation. It stopped working after I used FmPro Migrator to convert some File Maker databases to MySQL It looks like mysqld has no access permissions to InnoDB and I do not know how to fix it.
0
1930
by: Robert Morgan | last post by:
------=_NextPart_000_0008_01C3600F.7D6CBCC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Shut down my Linux PC running MySqld and rebooted this morning and = cannot get mysqld up. In services when I click on mysqld I get the = message "Mysqld dead subsys locked" when i restart the server it says = mysql succesfully restarted, but it isnt. When I try to stop the server = it comes back with...
0
1731
by: Robert Morgan | last post by:
------=_NextPart_000_0009_01C36013.CF9CC9F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ----- Original Message -----=20 From: Robert Morgan=20 To: mysqllist=20 Sent: Monday, August 11, 2003 1:50 PM
0
624
by: Gary Cote | last post by:
>Description: I've recently compiled mysql 4.0.14 on redhat 8.0. The installation fails, however, when running mysql_install_db. I've attached a transcript below. I gather from searching the 'net that this isn't an entirely unusual thing to happen, and is likely the result of some misconfiguration on my part, or perhaps a version incompatability with my libc. Unfortunately, I haven't seen any concrete suggestions on how to get past it.
3
5623
by: Paul | last post by:
I'm using ssh to administer a mysql server, version 3.23.49, which I just installed. The problem when starting mysqld: I type "mysqld" at the shell prompt and hit return, then I get the message "mysqld: ready for connections". But then it doesn't give me back the shell prompt. I can type stuff on the screen, but it doesn't do anything. I've tried Ctrl-C and Ctrl-Z, but that does nothing. Any ideas? Thanks. Paul
4
4533
by: Alex Shi | last post by:
Hi, In /etc/my.cnf I put an entry under section for mysqld.log as following: log = /var/log/mysqld.log However, mysqld actually does not log anything. Can any one out here help me to make it working, please give me a hand. Thanks in advance!
1
16809
by: Jeremy Kohansimeh | last post by:
Hello, I just installed version 4.0.21 on a Mandrake 8.2 system. I cannot get the MySql daemon to run. I am using the following commands, and receiving these errors: $mysqld_safe --user=mysql Starting mysqld daemon with databases from /var/lib/mysql STOPPING server from pid file /var/lib/mysql/JBrain.pid 040921 09:01:55 mysqld ended
0
1369
by: kelvlam | last post by:
I have written a service that is depending on mysqld. The service startup just fine, but I would like to have my service *always* shutdown first before mysqld does. That way I can add some log into my table before the service shutdown. As I search online, I haven't found any way to do so. Since the "service dependencies" setting of services is only used at startup stage, but not at shutdown stage. Is there any way to intercept the...
0
3639
by: tomzam | last post by:
I'm trying to get mysql working on Fedora Core 4. Actually trying to start the program mysqld without fatal errors. I posted this message first on the linux misc group - but no luck so far. Maybe people on this group can help me out. Sorry about posting to two groups. The reference manual for mysql ver 4.1 is huge, it's over 1900 pages! I've tried all day but now I have to ask for help from people more experienced then me. Anyway, this is...
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9955
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.