Kategoriearchiv 'MySql'
  |  
Markus am 21.09.08 um 4:30 pm Uhr

Basic mysql-commands for wordpress-use

MySql, Wordpress

Today, I copied my blog to a local webserver - just for testing. And then I was in the need of changeing some basic information in the database. I had to change the siteurl of the blog, which is stored inside the mysql-database.

So, how can you change your site-url of the wordpress-blog by using mysql?
First log into your mysql-database

mysql -u user -p

After this have a look at all your databases:

mysql>show databases;

This may look somewhat like that:

+--------------------+ | Database | +--------------------+ | information_schema | | wordpress | | mysql | +--------------------+

Now, choose your database (in this case wordpress):
mysql>use wordpress;

After this, let’s have a look at the tables:
mysql>show tables;

The result looks like that.

+---------------------------+ | Tables_in_wordpress | +---------------------------+ | wp_comments | | wp_ec3_schedule | | wp_links | | wp_metar_cache | | wp_now_reading | | wp_now_reading_books2tags | | wp_now_reading_meta | | wp_now_reading_tags | | wp_options | | wp_postmeta | | wp_posts | | wp_term_relationships | | wp_term_taxonomy | | wp_terms | | wp_usermeta | | wp_users | +---------------------------+

Most certainly, the needed information is stored in wp_options. So let’s have a more detailled look at this table:
mysql>describe wordpress_options;

+--------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+----------------+ | option_id | bigint(20) | NO | PRI | NULL | auto_increment | | blog_id | int(11) | NO | PRI | 0 | | | option_name | varchar(64) | NO | PRI | | | | option_value | longtext | NO | | | | | autoload | varchar(20) | NO | | yes | | +--------------+-------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec)

Now, we are searching for the right name inside the database.

mysql>select option_name from wordpress_options;
(Output is slightly abridged :-) )

+-----------------------------------------+ | option_name | +-----------------------------------------+ | siteurl | +-----------------------------------------+

OK, now let’s see, what is stored in this value…

mysql>select option_value from wp_options where option_name=’siteurl’;

+-----------------------------+ | option_value | +-----------------------------+ | http://www.gimme-th.at/blog | +-----------------------------+ 1 row in set (0.00 sec)

So, the last task is to change the value to the new url.
mysql>update wp_option set option_value=’http://localhost/blog’ where option_name=’siteurl’;

And that’s it.

Markus am 14.02.07 um 11:08 pm Uhr

Umzugsaktivitäten

MySql, Server

… standen heute an. Zumindest sicherheitshalber. Schließlich und endlich scheint ja die Platte des Servers, auf dem die Wörterpresse liegt, einen Schaden zu haben. Also sollte der blog gesichert werden. Gesagt getan.

  1. Den anderen debian-Rechner mit my-sql versorgt:

    apt-get install mysql-common
    apt-get install mysql-server
    apt-get install mysql-client
    apt-get install php5-mysql

  2. Einen root für den mysqld kreiert

    mysqladmin -u root password ‘NewPassword

  3. Die Wörterpresse und den zugehörigen Datenbankordner mit scp kopiert

    scp -r /var/www/blog user@192.xxx.xxx.xxx:/var/www/blog
    scp -r /var/lib/mysql/datenbank_name user@192.xxx.xxx.xxx:/var/lib/mysql/datenbank_name

  4. Den Datenbankrechner mit Rechten für mysql versehen

    chown -r mysql:mysql /var/lib/mysql/datenbank_name

  5. In mysql den selben Nutzer, wie auf dem Server eingerichtet

    mysql -u root -p
    ****
    GRANT ALL ON datenbank_name.* TO newuser@localhost

  6. Getestet mit http://localhost/blog –> Geht. Gut.

Sicherlich gibt es da komfortablere und schönere Wege. Die kenne ich aber (noch) nicht. Leider. Falls jemand mehr und besseres weiß: immer her damit.

Einige Hilfe gab es natürlich auch.

mrre am 01.02.07 um 8:30 pm Uhr

Sehr lohnenswert

Apache, MySql

… war ein früher Feierabend - wie man sieht:

  • mysqld –> läuft
  • apache2 –> läuft
  • Port 80 Anfragen –> werden durchgeroutet
  • just for fun, this blog is running

Was war zu tun?

Nachdem debian sarge installiert war, lief noch kein mysqld. Also: Package nachladen. apt-get install mysql ging nicht, da in der /etc/apt/sources.list keine Quelle dafür angegeben war. Also das Package downgeloaded . Aber es ging nicht zu installieren, da fehlende Abhängigkeiten festgestellt wurden (mysql-common und mysql-client fehlte). Doch, die ultimative Möglichkeit war: sources.list erweitern. Mit: deb http://ftp.de.debian.org/debian main stable non-free. Dann ein apt-get update durchführen. Anschließend apt-get install mysql. Und siehe da: es wurde alles installiert. Aber: mysqld lief immer noch nicht freiwillig. Es konnten privilege-tables für Passwörter usw. nicht gefunden werden. Doch dafür gibt es google! mysql_install_db war die Lösung. Dann user anlegen und fertig.

Anschließend wordpress installiert. Das war dann der Abend!

Weiterarbeit:

  • .htaccess erstellen
  • Benutzerrechte für apache passend einstellen
  |