我想用cl-dbi连接mysql。
使用 quicklisp 在 sbcl 上安装 cl-dbi 后,尝试连接 mysql 但失败并出现以下错误:
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
T
* (ql:quickload :cl-dbi)
To load "cl-dbi":
Load 2 ASDF systems:
alexandria closer-mop
Install 6 Quicklisp releases:
cl-annot cl-dbi cl-syntax named-readtables
split-sequence trivial-types
; Fetching #<URL "http://beta.quicklisp.org/archive/split-sequence/2012-07-03/split-sequence-1.1.tgz">
; 3.78KB
==================================================
3,872 bytes in 0.01 seconds (420.14KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-annot/2015-04-07/cl-annot-20150407-git.tgz">
; 9.80KB
==================================================
10,039 bytes in 0.00 seconds (9803.71KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/trivial-types/2012-04-07/trivial-types-20120407-git.tgz">
; 3.15KB
==================================================
3,228 bytes in 0.00 seconds (0.00KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/named-readtables/2015-03-02/named-readtables-20150302-git.tgz">
; 31.96KB
==================================================
32,732 bytes in 0.37 seconds (86.86KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-syntax/2015-04-07/cl-syntax-20150407-git.tgz">
; 3.03KB
==================================================
3,102 bytes in 0.00 seconds (3029.30KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-dbi/2015-04-07/cl-dbi-20150407-git.tgz">
; 11.13KB
==================================================
11,393 bytes in 0.71 seconds (15.76KB/sec)
; Loading "cl-dbi"
[package trivial-types]...........................
[package editor-hints.named-readtables]...........
[package editor-hints.named-readtables]...........
[package cl-syntax]...............................
[package cl-annot.util]...........................
[package cl-annot.core]...........................
[package cl-annot.expand].........................
[package cl-annot.syntax].........................
[package cl-annot.helper].........................
[package cl-annot]................................
[package cl-annot.std]............................
[package cl-annot.eval-when]......................
[package cl-annot.doc]............................
[package cl-annot.class]..........................
[package cl-annot.slot]...........................
[package split-sequence]..........................
[package closer-mop]..............................
[package closer-common-lisp]......................
[package closer-common-lisp-user].................
[package dbi.error]...............................
[package dbi.driver]..............................
[package dbi].
(:CL-DBI)
* (defvar *connection*
(dbi:connect :mysql
:database-name "dbname"
:username "username"
:password "pwd"))
To load "dbd-mysql":
Load 1 ASDF system:
dbd-mysql
; Loading "dbd-mysql"
To load "cl-mysql":
Load 1 ASDF system:
alexandria
Install 4 Quicklisp releases:
babel cffi cl-mysql trivial-features
; Fetching #<URL "http://beta.quicklisp.org/archive/trivial-features/2015-01-13/trivial-features-20150113-git.tgz">
; 10.22KB
==================================================
10,465 bytes in 0.00 seconds (10219.73KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/babel/2014-12-17/babel-20141217-git.tgz">
; 243.81KB
==================================================
249,666 bytes in 6.30 seconds (38.73KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cffi/2014-11-06/cffi_0.14.0.tgz">
; 207.73KB
==================================================
212,717 bytes in 9.06 seconds (22.92KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-mysql/2015-03-02/cl-mysql-20150302-git.tgz">
; 24.99KB
==================================================
25,594 bytes in 0.15 seconds (165.52KB/sec)
; Loading "cl-mysql"
[package babel-encodings].........................
[package babel]...................................
..................................................
[package cffi-sys]................................
[package cffi]....................................
..................................................
[package cffi-features]...........................
[package com.hackinghat.cl-mysql-system].....
debugger invoked on a LOAD-FOREIGN-LIBRARY-ERROR in thread
#<THREAD "main thread" RUNNING {B3E2369}>:
Unable to load foreign library (LIBMYSQLCLIENT).
Error opening shared object "libmysqlclient_r.so":
libmysqlclient_r.so: cannot open shared object file: No such file or directory.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [RETRY ] Try loading the foreign library again.
1: [USE-VALUE ] Use another library instead.
2: [TRY-RECOMPILING ] Recompile system and try loading it again
3: [RETRY ] Retry
loading FASL for #<CL-SOURCE-FILE "cl-mysql" "system">.
4: [ACCEPT ] Continue, treating
loading FASL for #<CL-SOURCE-FILE "cl-mysql" "system">
as having been successful.
5: Retry ASDF operation.
6: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the
configuration.
7: [ABORT ] Give up on "cl-mysql"
8: Give up on "dbd-mysql"
9: Exit debugger, returning to top level.
(CFFI::FL-ERROR "Unable to load foreign library (~A).~% ~A" LIBMYSQLCLIENT "Error opening shared object \"libmysqlclient_r.so\":
libmysqlclient_r.so: cannot open shared object file: No such file or directory.")
环境信息:操作系统:debian 8.1 mysql:5.5.43-0+deb8u1 sbcl:SBCL 1.2.4.debian
也未能使用 cl-mysql clsql。
任何人都可以提供一些线索吗?