On Monday, May 13, 2013 12:02:50 AM UTC-7, xiangjun zhang wrote:

> [root@vps web]# trac-admin /web/xserver initenv
> Creating a new Trac environment at /web/xserver
>
> Trac will first ask a few questions about your environment 
> in order to initialize and prepare the project database.
>
>  Please enter the name of your project.
>  This name will be used in page titles and descriptions.
>
> Project Name [My Project]> xserver
>  
>  Please specify the connection string for the database to use.
>  By default, a local SQLite database is created in the environment
>  directory. It is also possible to use an already existing
>  PostgreSQL database (check the Trac documentation for the exact
>  connection string syntax).
>
> Database connection string [sqlite:db/trac.db]> 
> mysql://root:foo@bar@localhost:3306/xserver
>
> Creating and Initializing Project
> Initenv for '/web/xserver' failed. 
> Failed to create environment.
> (2005, "Unknown MySQL server host 'bar@localhost' (2)")
> Traceback (most recent call last):
>   File "/usr/lib/python2.6/site-packages/trac/admin/console.py", line 455, 
> in do_initenv
>     options=options)
>   File "/usr/lib/python2.6/site-packages/trac/core.py", line 124, in 
> __call__
>     self.__init__(*args, **kwargs)
>   File "/usr/lib/python2.6/site-packages/trac/env.py", line 281, in 
> __init__
>     self.create(options)
>   File "/usr/lib/python2.6/site-packages/trac/env.py", line 572, in create
>     DatabaseManager(self).init_db()
>   File "/usr/lib/python2.6/site-packages/trac/db/api.py", line 239, in 
> init_db
>     connector.init_db(**args)
>   File "/usr/lib/python2.6/site-packages/trac/db/mysql_backend.py", line 
> 111, in init_db
>     params)
>   File "/usr/lib/python2.6/site-packages/trac/db/mysql_backend.py", line 
> 92, in get_connection
>     cnx = MySQLConnection(path, log, user, password, host, port, params)
>   File "/usr/lib/python2.6/site-packages/trac/db/mysql_backend.py", line 
> 263, in __init__
>     port=port, charset='utf8', **opts)
>   File "/usr/lib64/python2.6/site-packages/MySQLdb/__init__.py", line 81, 
> in Connect
>     return Connection(*args, **kwargs)
>   File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 
> 187, in __init__
>     super(Connection, self).__init__(*args, **kwargs2)
> OperationalError: (2005, "Unknown MySQL server host 'bar@localhost' (2)")
>
> Pity.. my password is foo@bar
>

The documentation says "Note that due to the way the above string is 
parsed, the "/" and "@" characters cannot be part of the password.". 
However, I'm not sure that is the whole story.

It appears that the thing to do here is URL encode the "@":

foo@bar -> foo%40bar

http://trac.edgewall.org/browser/tags/trac-1.0.1/trac/db/tests/api.py?marks=258-260#L257

Let me know if it works, and if so, I think we should add a note to the 
documentation. 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to