カテゴリー: Mysql

Ubuntu12.04でLamppを自動起動させる

Ubuntu12.04 32bitに FuelPHPの開発環境をインストールしたのだが、PC起動時にLamppを自動するように設定する。

開発環境なので、とりあえず起動すれば良いという事で rc.local に起動コマンドを記述する。

※PC起動時になぜかMysqlが中途半端に上がっていてLamppの起動が失敗するので、ちょっとひと工夫あり。
先にRailsの開発環境を構築していたためにお互いに影響しあっているのかもしれないが、時間がもったいないので原因究明は後回し。
apt-get で Mysql は削除したのにどうもおかしい・・・

$ sudo vi /etc/rc.local

・・・・・・・8<・・・・・・・ /etc/init.d/mysql stop && sleep 10 ; /opt/lampp/lampp start ・・・・・・・>8・・・・・・・

Mysqlでrootのパスワードを忘れたとき

勉強のために一時的に構築したサーバでMysqlを使っていたが、“一時的”ということで油断してしまいMysqlのrootのパスワードを忘れてしまった。(汗)

こんな時は、

# /etc/init.d/mysqld stop
# /etc/init.d/mysqld startsos

とすれば、「–skip-grant-tables」「–skip-networking」を付けてmysqldプロセスを起動できる。

このオプションの意味は以下の通り。

–skip-grant-tables … どんなユーザでも接続可能な状態で起動
–skip-networking … ローカル接続のみ可能な状態で起動

# /etc/init.d/mysqld restart

するのを忘れないこと。

WordPressインストール時のMysqlの操作

# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.5.27 MySQL Community Server (GPL) by Remi

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wp_user@localhost IDENTIFIED BY '**********';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE DATABASE wordpress DEFAULT CHARACTER SET UTF8;
Query OK, 1 row affected (0.00 sec)

mysql> SHOW DATABASES;

 +--------------------+
 | Database           |
 +--------------------+
 | information_schema |
 | mysql              |
 | postfix            |
 | test               |
 | wordpress          |
 +--------------------+
 5 rows in set (0.00 sec)

 

© 2023 Opendream

Theme by Anders Noren上へ ↑