From: Jeff D. <da...@da...> - 2001-11-15 20:50:15
|
On Thu, 15 Nov 2001 20:58:17 +0100 "Tara Star" <te...@cl...> wrote: > See the idea? use the same engine for two different wikis. Yes, that's exactly the reason we moved the config info from lib/config.php into index.php. > Just one thing: > > when I have to create tables in the db, with: > > mysql -uuser -ppassword dbname <schemas/schema.mysql > > what am I doing exactly? The command 'mysql -uuser -ppassword dbname' connects to the mysql server (on localhost) using the username 'user' and password 'password'. It then effectively does a 'use dbname;'. The '< schemas/schema.mysql' feeds the contents of the file schemas/schema.mysql into the standard input of the 'mysql ...' command. Essentially, it causes mysql to execute the SQL commands in schema.mysql. Those commands: 1. Delete any pre-existing tables in the current database which are named: page, version, recent, nonempty, or link. 2. Creates new tables with those names, with schema (columns) the way PhpWiki wants them to be. Roughly: it erases an PhpWiki data which might be in the selected database, and then re-initializes the tables (to any empty wiki). (Then, the first time you try to browse the HomePage of an empty wiki, PhpWiki will load it up with the default pgsrc...) Since this erases existing data in the selected database, you are right to be wary of performing this command. > because I see a file named schema.mysql in the > schemas directory... so I guess we're using that, right? Right. But only when you run the 'mysql < schema.mysql' command. > And at the top > of this file is written "use DbForWiki1" - I think that was added at > some point earlier for trying to get the whole thing to work. GET RID OF THAT LINE! It's not necessary, if you leave it there, then the command you propose above will erase all data in DbForWiki1. (You must have added it. There is no "use" line in the stock version.) > so, what should I do? try removing the "use DbForWiki1" line and see if > wiki1 still works? (do I run any risk of breaking something if I do that?) The contents of schema.mysql are only used when you initialize the database. You could delete schema.mysql, or edit it in any way you want now, and it won't break your existing wiki. (Unless of course you feed it to mysql again.) > or should I duplicate schema.mysql into wiki2schema.mysql, and change > the "use" line? would this break things later on for wiki2? Just delete the "use" line. The only time you should have to edit schema.mysql is if you set $DBParams['prefix'] to a non-empty value. (You would want to do this if you wanted to run two independent wikis in one mysql database. Since you have the ability to create a second database for the second wiki, that is the better way to go.) Once you delete the "use" line, then (as you proposed) just: mysql -uuser -ppasswd DbForNewWiki < schemas/schema.mysql Before you do that, if you're paranoid --- it's probably a good idea even if you're not --- you might make a backup of database for your first wiki by doing something like: mysqldump -uuser -ppasswd DbForWiki1 > wiki1-backup.mysql |