mysql linux安装

1、download mysql rpm package

http://dev.mysql.com/downloads/mysql/5.5.html#downloads

server:MySQL-server-5.5.32-1.linux2.6.i386.rpm

client:MySQL-client-5.5.32-1.linux2.6.i386.rpm


2、add group and user

[root@localhost soft]# groupadd mysql
[root@localhost soft]# useradd mysql -g mysql

3、install server

判断是否安装mysql

[root@master soft]# rpm -qa | grep MySQL
[root@master soft]# rpm -qa | grep mysql

如果安装过先卸载

[root@master soft]# rpm -qa | grep mysql
mysql-libs-5.1.66-2.el6_3.i686
[root@master soft]# rpm -e mysql-libs-5.1.66-2.el6_3.i686
error: Failed dependencies:
	libmysqlclient.so.16 is needed by (installed) postfix-2:2.6.6-2.2.el6_1.i686
	libmysqlclient.so.16(libmysqlclient_16) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.i686
	mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.i686
[root@master soft]# rpm -e --nodeps  mysql-libs-5.1.66-2.el6_3.i686

[root@localhost soft]# pwd
/usr/soft
[root@localhost soft]# rpm -ivh MySQL-server-5.5.32-1.linux2.6.i386.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

[root@localhost soft]# 


4、install client

[root@localhost bin]# cd /usr/soft/
[root@localhost soft]# ls
apache-ant-1.9.1             apache-nutch-2.1-src.tar.gz  jdk1.6.0_45              MySQL-client-5.5.32-1.linux2.6.i386.rpm  node-v0.6.18         vmware-tools-distrib
apache-ant-1.9.1-bin.tar.gz  database                     jdk-6u45-linux-i586.bin  MySQL-server-5.5.32-1.linux2.6.i386.rpm  node-v0.6.18.tar.gz
[root@localhost soft]# rpm -ivh MySQL-client-5.5.32-1.linux2.6.i386.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]
[root@localhost soft]# 

5、start mysql server and modify password

[root@localhost /]# /etc/init.d/mysql start
Starting MySQL.......                                      [确定]
/usr/bin/mysqladmin -u root password 'root'

6、test

[root@localhost /]# cd /
[root@localhost /]# netstat -nat | grep 3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      
[root@localhost /]# mysql -uroot -proot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.5.32 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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> 

7、create other user

mysql> insert into user(Host,User,Password) values ('%','mysql',password('mysql'));
Query OK, 1 row affected, 3 warnings (0.00 sec)
grant all privileges on nutch.* to mysql@'%';
mysql> flush privileges;
8、修改配置文件及默认编码

拷贝配置文件

[root@localhost ~]# cd /usr/share/mysql/
[root@localhost mysql]# cp -r my-medium.cnf /etc/my.cnf

修改配置文件:

在[client]节点下增加配置项:default-character-set = utf8

在[mysqld]节点下增加配置项:

character_set_server = utf8
datadir = /var/lib/mysql

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值