mysql 安装
时间:2006-08-02 来源:wxgchinaunix
mysql 安装
——————————————————
OS:RedHat9.0
kernel: 2.4.20
——————————————————
1.安装版本的选择: 这里使用较新的mysql5.0 安装。
注意 mysql 官方不建议使用Tarball(Source Code)方式安装,所以我们采用
由mysql自己编译好的binary方式来安装,简单。当然,mysql还给Redhat企业版等
提供了Rpm的安装包。 2.下载
这里要注意了,由于glibc的版本不同需要下载相应的tar, 看看自己的glibc版本
rpm -qa | grep glibc glibc-common-2.3.2-27.9.7
glibc-kernheaders-2.4-8.10
glibc-2.3.2-27.9.7
glibc-devel-2.3.2-27.9.7
glibc-utils-2.3.2-27.9.7 我的机器上是2.3,所以我下载了
mysql-max-5.0.22-linux-i686-glibc23.tar.gz 保存到/wxd/tar/mysql (选择max ,免得有什么功能没有安装,哈哈) 3.解压缩, #cd /usr/local
#tar -zxvf /wxd/tar/mysql/mysql-max-5.0.22-linux-i686-icc-glibc23.tar.gz #ln -s /wxd/tar/mysql/mysql-max-5.0.22-linux-i686-icc-glibc23.tar.gz mysql
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
将配置文件拷贝到/etc
4.建立mysql需要的用户和组
添加mysql用户及用户组
# groupadd mysql
# useradd -g mysql mysql 修改mysql目录权限
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
(以上两句可以直接#chown -R root:mysql /usr/local/mysql) # chown -R mysql /usr/local/mysql/data
操作mysql数据库的用户是mysql 所以要拥有数据库目录的所有权 5.生成系统数据库 # /usr/local/mysql/scripts/mysql_install_db --user=mysql& 6.启动mysql
# /usr/local/mysql/bin/safe_mysqld --user=mysql& **注意:执行完这个命令后,会在/tmp产生一个mysql.sock 的文件 这是访问mysql必须的!
**注意是safe_mysqld 不是mysqld_safe
另外,mysql目录下有一个安装文件 INSTALL-BINARY ,介绍了安装的步骤!
其他设定:
关于mysql的一些配置项可以在/etc/my.cnf 中更改! 另外, 设置mysql执行程序的path:
#vi /etc/profile
添加:
PATH="$PATH":/usr/local/mysql/bin
不要忘了
export PATH 设置mysql开机启动
cd /usr/local/mysql; /usr/local/mysql/bin/safe_mysqld --user=mysql & 或者使用mysql 提供的脚本
cp /usr/local/mysql/support-files/mysql.server /usr/local/mysql/bin mysql.server start 启动mysql
mysql.server stop 停止mysql 修改mysql超级用户root的密码 #mysqladmin -u root -p password '123456'
Enter password:
回车就行 ,默认的密码为空
登陆mysql 看看 mysql -u root -p 输入密码 Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22-max-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
看看系统数据库 mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec) 不过现在还不能从Remote 访问! 增加一个本地访问超级用户
mysql>GRANT ALL PRIVILEGES ON *.* TO hotplum@localhost
IDENTIFIED BY '12345' WITH GRANT OPTION; 增加一个远端访问超级用户
mysql>GRANT ALL PRIVILEGES ON *.* TO hotplum@"%"
IDENTIFIED BY '12345' WITH GRANT OPTION;
@"%"为任意位置访问 12345 是访问密码
有关编码:
显示系统编码
SHOW VARIABLES LIKE 'character_set_%'; #cd /usr/local 解决方法的链接在这里:http://bbs.chinaunix.net/viewthr ... &extra=page%3D1
系统: RHEL-U2. mysql-max-5.0.16-linux-i686-glibc23.tar.gz
shell>groupadd mysql
shell>useradd -g mysql mysql
shell>./mysql_install_db --user=mysql
/*出来提示: */
./mysql_install_db: line 85: my_print_defaults: command not found
Could not find help file 'fill_help_tables.sql' in ./support-files or inside ..
/*接着退出 scripts/ 目录, 在 mysql/ 目录下打入命令: */
shell>scripts/mysql_install_db --user=mysql
/*出现不同的提示: */
Installing all prepared tables
Fill help tables
HELP FILES CAN NOT COMPLETE INSTALL
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
See the manual for more instructions.
NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run
the ./bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the ./bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
/*知道出问题了,却继续试着安装*/
shell>chown -R root .
shell>chgrp -R mysql data
shell>./bin/mysqld_safe --user=mysql &
——————————————————
OS:RedHat9.0
kernel: 2.4.20
——————————————————
1.安装版本的选择: 这里使用较新的mysql5.0 安装。
注意 mysql 官方不建议使用Tarball(Source Code)方式安装,所以我们采用
由mysql自己编译好的binary方式来安装,简单。当然,mysql还给Redhat企业版等
提供了Rpm的安装包。 2.下载
这里要注意了,由于glibc的版本不同需要下载相应的tar, 看看自己的glibc版本
rpm -qa | grep glibc glibc-common-2.3.2-27.9.7
glibc-kernheaders-2.4-8.10
glibc-2.3.2-27.9.7
glibc-devel-2.3.2-27.9.7
glibc-utils-2.3.2-27.9.7 我的机器上是2.3,所以我下载了
mysql-max-5.0.22-linux-i686-glibc23.tar.gz 保存到/wxd/tar/mysql (选择max ,免得有什么功能没有安装,哈哈) 3.解压缩, #cd /usr/local
#tar -zxvf /wxd/tar/mysql/mysql-max-5.0.22-linux-i686-icc-glibc23.tar.gz #ln -s /wxd/tar/mysql/mysql-max-5.0.22-linux-i686-icc-glibc23.tar.gz mysql
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
将配置文件拷贝到/etc
4.建立mysql需要的用户和组
添加mysql用户及用户组
# groupadd mysql
# useradd -g mysql mysql 修改mysql目录权限
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
(以上两句可以直接#chown -R root:mysql /usr/local/mysql) # chown -R mysql /usr/local/mysql/data
操作mysql数据库的用户是mysql 所以要拥有数据库目录的所有权 5.生成系统数据库 # /usr/local/mysql/scripts/mysql_install_db --user=mysql& 6.启动mysql
# /usr/local/mysql/bin/safe_mysqld --user=mysql& **注意:执行完这个命令后,会在/tmp产生一个mysql.sock 的文件 这是访问mysql必须的!
**注意是safe_mysqld 不是mysqld_safe
另外,mysql目录下有一个安装文件 INSTALL-BINARY ,介绍了安装的步骤!
其他设定:
关于mysql的一些配置项可以在/etc/my.cnf 中更改! 另外, 设置mysql执行程序的path:
#vi /etc/profile
添加:
PATH="$PATH":/usr/local/mysql/bin
不要忘了
export PATH 设置mysql开机启动
cd /usr/local/mysql; /usr/local/mysql/bin/safe_mysqld --user=mysql & 或者使用mysql 提供的脚本
cp /usr/local/mysql/support-files/mysql.server /usr/local/mysql/bin mysql.server start 启动mysql
mysql.server stop 停止mysql 修改mysql超级用户root的密码 #mysqladmin -u root -p password '123456'
Enter password:
回车就行 ,默认的密码为空
登陆mysql 看看 mysql -u root -p 输入密码 Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22-max-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
看看系统数据库 mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec) 不过现在还不能从Remote 访问! 增加一个本地访问超级用户
mysql>GRANT ALL PRIVILEGES ON *.* TO hotplum@localhost
IDENTIFIED BY '12345' WITH GRANT OPTION; 增加一个远端访问超级用户
mysql>GRANT ALL PRIVILEGES ON *.* TO hotplum@"%"
IDENTIFIED BY '12345' WITH GRANT OPTION;
@"%"为任意位置访问 12345 是访问密码
有关编码:
显示系统编码
SHOW VARIABLES LIKE 'character_set_%'; #cd /usr/local 解决方法的链接在这里:http://bbs.chinaunix.net/viewthr ... &extra=page%3D1
系统: RHEL-U2. mysql-max-5.0.16-linux-i686-glibc23.tar.gz
shell>groupadd mysql
shell>useradd -g mysql mysql
shell>./mysql_install_db --user=mysql
/*出来提示: */
./mysql_install_db: line 85: my_print_defaults: command not found
Could not find help file 'fill_help_tables.sql' in ./support-files or inside ..
/*接着退出 scripts/ 目录, 在 mysql/ 目录下打入命令: */
shell>scripts/mysql_install_db --user=mysql
/*出现不同的提示: */
Installing all prepared tables
Fill help tables
HELP FILES CAN NOT COMPLETE INSTALL
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
See the manual for more instructions.
NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run
the ./bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the ./bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
/*知道出问题了,却继续试着安装*/
shell>chown -R root .
shell>chgrp -R mysql data
shell>./bin/mysqld_safe --user=mysql &
相关阅读 更多 +