- 论坛徽章:
- 0
|
在这里使用的是MySQL二进制分发版
[root@Enterprise ~]# groupadd mysql
[root@Enterprise ~]# useradd -g mysql mysql
[root@Enterprise ~]# ls
mysql-6.0.0-alpha-linux-i686-glibc23.tar.gz
[root@Enterprise ~]# cd /usr/local
[root@Enterprise local]# gunzip
建立软链接
[root@Enterprise local]# ln -s /usr/local/mysql-6.0.0-alpha-linux-i686-glibc23 mysql
[root@Enterprise local]# cd mysql
改变目录的属组和所有者
[root@Enterprise mysql]# chown -R mysql .
[root@Enterprise mysql]# chgrp -R mysql .
创造MySQL授权表
[root@Enterprise mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
[root@Enterprise mysql]# chown -R root .
[root@Enterprise mysql]# chown -R mysql data
测试启动mysql
[root@Enterprise mysql]# bin/mysqld_safe --user==mysql &
Starting mysqld daemon with databases from /var/lib/mysql
关闭
[root@Enterprise mysql]# bin/mysqladmin shutdown
STOPPING server from pid file /var/lib/mysql/mysqld.log
070727 07:50:25 mysqld ended
MySQL默认的数据文件存储目录为/var/lib/mysql,如果启动失败,需要改配置文件
[root@Enterprise mysql]# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
或者直接修改/etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql
basedir=/var/lib/mysql
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysqld.log
[client]
socket=/var/lib/mysql/mysql.sock
进入mysql
[root@Enterprise support-files]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 6.0.0-alpha
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
| test_db |
+--------------------+
4 rows in set (0.04 sec)
mysql> quit
执行脚本
mysql> source /home/mysql/test.sql
Query OK, 0 rows affected (0.03 sec)
先写这么多,以后再补充。
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/43136/showart_348274.html |
|