LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 705|回复: 4

在slackware上安装mysql出现问题,请帮忙。

[复制链接]
发表于 2004-3-3 10:45:05 | 显示全部楼层 |阅读模式
1、用instalpkg 安装时如何指定(想要)程序安装路径?
2、安装完成后初始化的步骤,大家能不能说说呢?
发表于 2004-3-3 12:52:05 | 显示全部楼层
别用slack的pkg包安装,到www.mysql.com 下载一个bin或者src安装。可以指定目录安装。具体可以看mysql的安装文档。
发表于 2004-3-3 15:39:09 | 显示全部楼层
发表于 2004-3-3 15:47:36 | 显示全部楼层
The basic commands you must execute to install and use a MySQL binary distribution are:

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql

If you would like to use mysqlaccess and have the MySQL distribution in some non-standard place, you must change the location where mysqlaccess expects to find the mysql client. Edit the `bin/mysqlaccess' script at approximately line 18. Search for a line that looks like this:
$MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable

Change the path to reflect the location where mysql actually is stored on your system. If you do not do this, you will get a Broken pipe error when you run mysqlaccess.

shell> scripts/mysql_install_db
shell> chown -R root  .
shell> chown -R mysql data
shell> chgrp -R mysql .
cp support-files/my-medium.cnf /etc/my.cnf#二进制发行版可能不需要

shell> bin/safe_mysqld --user=mysql &
or
shell> bin/mysqld_safe --user=mysql &
if you are running MySQL 4.x

6) 为 root 设置密码

/usr/local/mysql/bin/mysqladmin -u root -p password your_new_password

注意,第一个 password 是命令的参数,依原样键入,而 your_new_password 就是你要设置的新密码。例如,要将 root 密码设为123456,那么这样输入命令:

/usr/local/mysql/bin/mysqladmin -u root -p password 123456

回车后系统会提示你输入当前密码,应该是像下面这样:

Enter password:

因为此时还没有密码,所以直接回车即可,这时没有任何提示返回提示符状态,而密码已经设置完成。此时可以通过关闭 MySQL 服务验证密码是否生效:

/usr/local/mysql/bin/mysqladmin -u root -p shutdown
Enter password:123456

系统提示 MySQL 已关闭:

020531 13:14:35 mysql ended
[1]+ Done /usr/local/mysql/bin/safe_mysqld --user=mysql

If you would like MySQL to start automatically when you boot your machine, you can copy support-files/mysql.server to the location where your system has its startup files. More information can be found in the support-files/mysql.server script itself and in section 2.4.3 Starting and Stopping MySQL Automatically.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

You need to add these start and stop commands to the appropriate places in your `/etc/rc*' files when you want to start up MySQL automatically on your server.

On most current Linux distributions, it is sufficient to copy the file mysql.server into the `/etc/init.d' directory (or `/etc/rc.d/init.d' on older Red Hat systems). Afterwards, run the following command to enable the startup of MySQL on system bootup:

shell> chkconfig --add mysql.server

As an alternative to the above, some operating systems also use `/etc/rc.local' or `/etc/init.d/boot.local' to start additional services on bootup. To start up MySQL using this method, you could append something like the following to it:

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'

You can also add options for mysql.server in a global `/etc/my.cnf' file. A typical `/etc/my.cnf' file might look like this:

[mysqld]
datadir=/usr/local/mysql/var
socket=/var/tmp/mysql.sock
port=3306
user=mysql

[mysql_server]
basedir=/usr/local/mysql

The mysql.server script understands the following options: datadir, basedir, and pid-file.
 楼主| 发表于 2004-3-8 15:16:22 | 显示全部楼层
谢谢各位了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表