免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1329 | 回复: 0
打印 上一主题 下一主题

Mysql在linux下的安装 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-07-27 17:00 |只看该作者 |倒序浏览
在这里使用的是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
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP