# pkg_search gives wrong package name



## da1 (Apr 23, 2011)

Hi guys,

I wanted to add the mysql tbz on a i386 8.1-RELEASE today, so I did:

```
[root@mainserver1 ~]# pkg_search mysql-server
mysql-server-3.23.59.n.20050301_3       Multithreaded SQL database (server)
mysql-server-4.0.27     Multithreaded SQL database (server)
mysql-server-4.1.25     Multithreaded SQL database (server)
mysql-server-5.0.90     Multithreaded SQL database (server)
mysql-server-5.1.48     Multithreaded SQL database (server)
mysql-server-5.5.4      Multithreaded SQL database (server)
```
and then:

```
[root@mainserver1 ~]# pkg_add -r mysql-server-5.5.4
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.1-release/Latest/mysql-server-5.5.4.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.1-release/Latest/mysql-server-5.5.4.tbz' by URL
```
The reason for this is the following:

```
[root@mainserver1 ~]# ftp ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.1-release/Latest/
Trying 2001:6c8:2:600::132...
Trying 2001:4f8:0:2::e...
Trying 87.51.34.132...
Connected to ftp.freebsd.org.
220 ftp.beastie.tdk.net FTP server (Version 6.00LS) ready.
331 Guest login ok, send your email address as password.
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
200 Type set to I.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
250 CWD command successful.
ftp> ls mysql
mysql++-mysql51.tbz                             mysql2odbc.tbz                                  [color="Red"]mysql50-server.tbz[/color]                              mysqlbackup.tbz
mysql-connector-java.tbz                        mysql2pgsql.tbz                                 [color="#ff0000"]mysql51-client.tbz[/color]                              mysqlcppapi.tbz
mysql-connector-odbc-unixodbc-mysql51.tbz       mysql40-client.tbz                              mysql51-q4m.tbz                                 mysqlidxchk.tbz
mysql-editor.tbz                                mysql40-scripts.tbz                             mysql51-scripts.tbz                             mysqlphp2postgres.tbz
mysql-gui-tools.tbz                             mysql40-server.tbz                              [color="#ff0000"]mysql51-server.tbz[/color]                              mysqlreport.tbz
mysql-navigator.tbz                             mysql41-client.tbz                              [color="#ff0000"]mysql55-client.tbz[/color]                              mysqlsla.tbz
mysql-proxy.tbz                                 mysql41-scripts.tbz                             mysql55-scripts.tbz                             mysqlsniffer.tbz
mysql-udf.tbz                                   mysql41-server.tbz                              [color="#ff0000"]mysql55-server.tbz[/color]                              mysqltcl.tbz
mysql-workbench-oss51.tbz                       [color="Red"]mysql50-client.tbz[/color]                              mysql_last_value.tbz                            mysqltuner.tbz
mysql-workbench-oss52.tbz                       mysql50-scripts.tbz                             mysqlard.tbz
```

I'm not exactly sure where pkg_search looks for the pkg name (I think in the INDEX file) but As far as I'm concerned, they should match.

It's not that hard to install via ports or simply download the tbz and then install it manually but it is quite annoying.

How can one fix this or help out ?


----------



## mamalos (Apr 23, 2011)

I am not sure how *pkg_search* works, but what is showing to you is not the name of the package to use with *pkg_add* but the full version name instead. In order to find the package I need, I usually do:

[cmd=]cd /usr/ports && make search name=mysql-server[/cmd]
...excerpt from output:

```
Port:	mysql-server-5.5.11
Path:	/usr/ports/databases/mysql55-server
```

and copy the last part of the Path directive on *pkg_add*:

`# pkg_add -r mysql55-server`

I remember there is a thread in this forum explaining all of this, but I don't remember which so as to direct you 

Good luck.


----------

