首页 > 代码库 > SUSE11 安装mysql

SUSE11 安装mysql

SUSE11 

检测系统是否安装MySQL

#rpm -qa | grep -i mysql
若已安装过,会出现:
MySQL-server-5.0.22-0.i386
MySQL-client-5.0.22-0.i386
那么输入以下命令删除它:
#rpm -ev MySQL-server-5.0.22-0.i386
# rpm -ev MySQL-client-5.0.22-0.i386
注意:若删除的时候,出现删除不成功,出现依赖的包,前提必须删除依赖项。rpm -ev dovecot-1.0.7-7.el5.x86_64

在suse11.2-64上先安装一个本地库: 用国内镜像,注意mysql 5.6.22 由于版本更新,所以可以直接访问http://mirrors.sohu.com/mysql/MySQL-5.6/ 查看新的版本,否则wget 下载不到需要的rpm文件.

     wget -c  http://mirrors.sohu.com/mysql/MySQL-5.6/MySQL-server-5.6.22-1.sles11.x86_64.rpm     (for suse11-64版本)

     wget -c  http://mirrors.sohu.com/mysql/MySQL-5.6/MySQL-client-5.6.22-1.sles11.x86_64.rpm

     wget -c  http://mirrors.sohu.com/mysql/MySQL-5.6/MySQL-devel-5.6.22-1.sles11.x86_64.rpm            

下载完成后开始安装:

    rpm -ivh MySQL-server-5.6.22-1.sles11.x86_64.rpm MySQL-client-5.6.22-1.sles11.x86_64.rpm MySQL-devel-5.6.22-1.sles11.x86_64.rpm

Preparing... ########################################### [100%] 

1:MySQL-client ########################################### [ 50%] 
2:MySQL-server ########################################### [100%] 
warning: user mysql does not exist - using root 
warning: group mysql does not exist - using root 
insserv: Service network is missed in the runlevels 4 to use service mysql 
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off 
2014-12-22 16:36:57 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2014-12-22 16:36:57 20644 [Note] InnoDB: Using atomics to ref count buffer pool pages 
2014-12-22 16:36:57 20644 [Note] InnoDB: The InnoDB memory heap is disabled 
2014-12-22 16:36:57 20644 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2014-12-22 16:36:57 20644 [Note] InnoDB: Memory barrier is not used 
2014-12-22 16:36:57 20644 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2014-12-22 16:36:57 20644 [Note] InnoDB: Using Linux native AIO 
2014-12-22 16:36:57 20644 [Note] InnoDB: Using CPU crc32 instructions 
2014-12-22 16:36:57 20644 [Note] InnoDB: Initializing buffer pool, size = 128.0M 
2014-12-22 16:36:57 20644 [Note] InnoDB: Completed initialization of buffer pool 
2014-12-22 16:36:57 20644 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 
2014-12-22 16:36:57 20644 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 
2014-12-22 16:36:57 20644 [Note] InnoDB: Database physically writes the file full: wait... 
2014-12-22 16:36:57 20644 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 
2014-12-22 16:36:57 20644 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 
2014-12-22 16:36:58 20644 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 
2014-12-22 16:36:58 20644 [Warning] InnoDB: New log files created, LSN=45781 
2014-12-22 16:36:58 20644 [Note] InnoDB: Doublewrite buffer not found: creating new 
2014-12-22 16:36:58 20644 [Note] InnoDB: Doublewrite buffer created 
2014-12-22 16:36:58 20644 [Note] InnoDB: 128 rollback segment(s) are active. 
2014-12-22 16:36:58 20644 [Warning] InnoDB: Creating foreign key constraint system tables. 
2014-12-22 16:36:58 20644 [Note] InnoDB: Foreign key constraint system tables created 
2014-12-22 16:36:58 20644 [Note] InnoDB: Creating tablespace and datafile system tables. 
2014-12-22 16:36:58 20644 [Note] InnoDB: Tablespace and datafile system tables created. 
2014-12-22 16:36:58 20644 [Note] InnoDB: Waiting for purge t start 
2014-12-22 16:36:58 20644 [Note] InnoDB: 5.6.22 started; log sequence number 0 
A random root password has been set. You will find it in ‘/root/.mysql_secret‘. 
2014-12-22 16:36:58 20644 [Note] Binlog end 
2014-12-22 16:36:58 20644 [Note] InnoDB: FTS optimize thread exiting. 
2014-12-22 16:36:58 20644 [Note] InnoDB: Starting shutdown... 
2014-12-22 16:37:00 20644 [Note] InnoDB: Shutdown completed; log sequence number 1625977 


2014-12-22 16:37:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2014-12-22 16:37:00 20666 [Note] InnoDB: Using atomics to ref count buffer pool pages 
2014-12-22 16:37:00 20666 [Note] InnoDB: The InnoDB memory heap is disabled 
2014-12-22 16:37:00 20666 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2014-12-22 16:37:00 20666 [Note] InnoDB: Memory barrier is not used 
2014-12-22 16:37:00 20666 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2014-12-22 16:37:00 20666 [Note] InnoDB: Using Linux native AIO 
2014-12-22 16:37:00 20666 [Note] InnoDB: Using CPU crc32 instructions 
2014-12-22 16:37:00 20666 [Note] InnoDB: Initializing buffer pool, size = 128.0M 
2014-12-22 16:37:00 20666 [Note] InnoDB: Completed initialization of buffer pool 
2014-12-22 16:37:00 20666 [Note] InnoDB: Highest supported file format is Barracuda. 
2014-12-22 16:37:00 20666 [Note] InnoDB: 128 rollback segment(s) are active. 
2014-12-22 16:37:00 20666 [Note] InnoDB: Waiting for purge to start 
2014-12-22 16:37:00 20666 [Note] InnoDB: 5.6.22 started; log sequence number 1625977 
2014-12-22 16:37:00 20666 [Note] Binlog end 
2014-12-22 16:37:00 20666 [Note] InnoDB: FTS optimize thread exiting. 
2014-12-22 16:37:00 20666 [Note] InnoDB: Starting shutdown... 
2014-12-22 16:37:02 20666 [Note] InnoDB: Shutdown completed; log sequence number 1625987 

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! 
You will find that password in ‘/root/.mysql_secret‘. 

You must change that password on your first connect, 
no other statement but ‘SET PASSWORD‘ will be accepted. 
See the manual for the semantics of the ‘password expired‘ flag. 

Also, the account for the anonymous user has been removed. 

In addition, you can run: 

/usr/bin/mysql_secure_installation 

which will also give you the option of removing the test database. 
This is strongly recommended for production servers. 

See the manual for more instructions. 

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at 

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and 
will be used by default by the server when you start it. 
You may edit this file to change server settings

 


linux:~ # more .mysql_secret

# The random password set for the root user at Mon Dec 22 16:36:58 2014 (local time): lXNgZ2zmMi1MsIht

 

linux:/usr # mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 10

Server version: 5.6.22

 

 

mysql> 

重新设置密码为 123456

mysql> SET PASSWORD = PASSWORD(‘123456‘);    #设置密码为123456
mysql> exit
 
编辑 my.cnf 修改字符集:
[client]  
#password        = 123456  
port            = 3306  
default-character-set=utf8  
[mysqld]  
port            = 3306  
character_set_server=utf8  
character_set_client=utf8  
collation-server=utf8_general_ci  
#(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)  
lower_case_table_names=1  
#(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )  
max_connections=1000  
[mysql]  
default-character-set = utf8  
 
重新启动  service mysql restart ,注意看是否错误.

 

SUSE11 安装mysql