takt@Wiki

MYSQL5 in CentOS 4

最終更新:

takt

- view
メンバー限定 登録/ログイン

MySQLインストール


インストール


# cd /tmp/src
# wget  http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz/from/http://ftp.iij.ad.jp/pub/db/mysql/
# tar zxvf mysql-5.0.45.tar.gz
# cd mysql-5.0.45
# groupadd mysql
# adduser -g mysql mysql
# ./configure --prefix=/usr/local/mysql --datadir=/data/mysql/data --with-mysqld-user=mysql --with-extra-charsets=all --with-charset=utf8
# make
# make install

初期設定&フォルダ権限変更

# chown -R mysql:mysql /usr/local/mysql (スクリプトフォルダ)
# cd /usr/local/mysql
# cp /tmp/src/mysql-5.0.45/.support-files/my-medium.cnf /etc/my.cnf
# /usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/var/mysql/data (データディレクトリ指定)
# chown -R root . (rootフォルダ)
# chown -R mysql:mysql /usr/local/mysql/var (データフォルダ)

起動スクリプトコピー

# cp /tmp/src/mysql-5.0.45/support-files/mysql.server /etc/rc.d/init.d/mysqld

起動スクリプトより起動

# /etc/rc.d/init.d/mysqld start

MySQLログイン

# /usr/local/mysql/bin/mysql -u root -p

無名ユーザー削除

mysql> select user, password, host from mysql.user;
mysql> delete from mysql.user where user="";

rootパスワード設定

mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'パスワード' WITH GRANT OPTION;


MySQLのパスを通す

# vi /etc/profile

最終行に以下を追加

export PATH=/usr/local/mysql/bin:$PATH




人気記事ランキング
ウィキ募集バナー