--redhat安装mysql小计
用rpm的方式安装mysql,其部署灵活性是不高的,存储目录路径最好不要随意去改变。
[root@nameNode ~]# groupadd mysql
[root@nameNode ~]# useradd mysql -g mysql
[root@nameNode ~]#
[root@nameNode mysql]# mkdir -p /u02/mysql/data
[root@nameNode mysql]#
[root@nameNode mysql]# ln -s /u02/mysql/data /var/lib/mysql
[root@nameNode mysql]#
[root@nameNode mysql]# yum install mysql -y
------------------------------------------------------------------
Total 49 MB/s | 12 MB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Public key for perl-Module-Pluggable-3.90-127.el6.x86_64.rpm is not installed
----有报错
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51:
[root@nameNode Packages]# rpm --import /etc/pki/rpmgpg/RPM*
[root@nameNode Packages]#
--再次install成功
[root@nameNode Packages]# yum install mysql -y
。。。
Installed:
mysql.x86_64 0:5.1.61-4.el6
Dependency Installed:
perl.x86_64 4:5.10.1-127.el6 perl-Module-Pluggable.x86_64 1:3.90-127.el6 perl-Pod-Escapes.x86_64 1:1.04-127.el6
perl-Pod-Simple.x86_64 1:3.13-127.el6 perl-libs.x86_64 4:5.10.1-127.el6 perl-version.x86_64 3:0.77-127.el6
Complete!
[root@nameNode Packages]# yum install mysql-server -y
...
Installed:
mysql-server.x86_64 0:5.1.61-4.el6
Dependency Installed:
perl-DBD-MySQL.x86_64 0:4.013-3.el6
perl-DBI.x86_64 0:1.609-4.el6
Complete!
---mysql安装完成,启动配置mysql
root@nameNode Packages]#service mysql start
root@nameNode Packages]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> grant all on *.* to 'root'@'%' identified by '123.com';
Query OK, 0 rows affected (0.00 sec)
mysql> set password=password('123.com');
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@nameNode Packages]#
[root@nameNode Packages]# vi /etc/my.cnf
###add items
[client]
port=3306
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8
[mysql]
no-auto-rehash
default-character-set=utf8
--启动mysql
[root@nameNode Packages]# service mysqld start
[root@nameNode data]# chkconfig mysqld on
[root@nameNode data]#