分享

suse安装mysql

 昵称10087950 2014-06-15
mysql -u mysql -p -S /var/lib/mysql/mysql.sock

1、先把系统里安装的所有mysql找出来
#rpm -qa | grep -i mysql 运行此命令后,显示所有列表:
linux-hueu:/ # rpm -qa | grep -i mysql
libmysqld18-5.5.33-2.2.x86_64
libmysqlcppconn6-1.1.2-4.1.3.x86_64
libqt4-sql-mysql-4.8.5-5.9.2.x86_64
MySQL-client-advanced-5.6.18-1.sles11.x86_64
libreoffice-base-drivers-mysql-4.1.5.3-17.1.x86_64
libmysqlclient18-5.5.33-2.2.x86_64
MySQL-server-advanced-5.6.18-1.sles11.x86_64

2、将列表一一强制删除:

卸载顺序:

[root@bakdbserver ~]# rpm -e MySQL-server-5.5.24-1.rhel5

[root@bakdbserver ~]# rpm -e MySQL-embedded-5.5.24-1.rhel5

[root@bakdbserver ~]# rpm -e MySQL-shared-5.5.24-1.rhel5

[root@bakdbserver ~]# rpm -e MySQL-devel-5.5.24-1.rhel5

[root@bakdbserver ~]# rpm -e MySQL-test-5.5.24-1.rhel5

[root@bakdbserver ~]# rpm -e MySQL-client-5.5.24-1.rhel5

 
#rpm -ev --nodeps MySQL-server-advanced-5.6.18-1.sles11.x86_64

#rpm -ev --nodeps MySQL-client-advanced-5.6.18-1.sles11.x86_64

3、将老版本的几个文件手工删除:
 
rm -f /etc/my.cnf
 
rm -rf /var/lib/mysql
 
rm -rf /var/share/mysql
 
rm -rf /usr/bin/mysql*


4.安装下载的版本的mysql,如上,
 
[root@oracle11 ~]#rpm -ivh MySQL-client-advanced-5.6.18-1.sles11.x86_64.rpm

[root@oracle11 ~]#rpm -ivh MySQL-server-advanced-5.6.18-1.sles11.x86_64.rpm


linux-hueu:/home/yangbing/soft/Mysql # rpm -ivh MySQL-server-advanced-5.6.18-1.sles11.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-server-advanced-5.6.18-1.sl################################# [100%]

Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.

mysql                     0:off  1:off  2:on   3:on   4:on   5:on   6:off
2014-06-15 22:12:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-06-15 22:12:15 13657 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-06-15 22:12:15 13657 [Note] InnoDB: The InnoDB memory heap is disabled
2014-06-15 22:12:15 13657 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-06-15 22:12:15 13657 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-06-15 22:12:15 13657 [Note] InnoDB: Using Linux native AIO
2014-06-15 22:12:15 13657 [Note] InnoDB: Not using CPU crc32 instructions
2014-06-15 22:12:15 13657 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-06-15 22:12:15 13657 [Note] InnoDB: Completed initialization of buffer pool
2014-06-15 22:12:15 13657 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-06-15 22:12:15 13657 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-06-15 22:12:15 13657 [Note] InnoDB: Database physically writes the file full: wait...
2014-06-15 22:12:15 13657 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-06-15 22:12:17 13657 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-06-15 22:12:21 13657 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-06-15 22:12:21 13657 [Warning] InnoDB: New log files created, LSN=45781
2014-06-15 22:12:21 13657 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-06-15 22:12:21 13657 [Note] InnoDB: Doublewrite buffer created
2014-06-15 22:12:21 13657 [Note] InnoDB: 128 rollback segment(s) are active.
2014-06-15 22:12:21 13657 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-06-15 22:12:21 13657 [Note] InnoDB: Foreign key constraint system tables created
2014-06-15 22:12:21 13657 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-06-15 22:12:22 13657 [Note] InnoDB: Tablespace and datafile system tables created.
2014-06-15 22:12:22 13657 [Note] InnoDB: Waiting for purge to start
2014-06-15 22:12:22 13657 [Note] InnoDB: 5.6.18 started; log sequence number 0
2014-06-15 22:12:22 13657 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2014-06-15 22:12:22 13657 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
A random root password has been set. You will find it in '/root/.mysql_secret'.
2014-06-15 22:12:26 13657 [Note] Binlog end
2014-06-15 22:12:26 13657 [Note] InnoDB: FTS optimize thread exiting.
2014-06-15 22:12:26 13657 [Note] InnoDB: Starting shutdown...
2014-06-15 22:12:28 13657 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2014-06-15 22:12:28 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-06-15 22:12:28 13681 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-06-15 22:12:28 13681 [Note] InnoDB: The InnoDB memory heap is disabled
2014-06-15 22:12:28 13681 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-06-15 22:12:28 13681 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-06-15 22:12:28 13681 [Note] InnoDB: Using Linux native AIO
2014-06-15 22:12:28 13681 [Note] InnoDB: Not using CPU crc32 instructions
2014-06-15 22:12:28 13681 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-06-15 22:12:28 13681 [Note] InnoDB: Completed initialization of buffer pool
2014-06-15 22:12:28 13681 [Note] InnoDB: Highest supported file format is Barracuda.
2014-06-15 22:12:28 13681 [Note] InnoDB: 128 rollback segment(s) are active.
2014-06-15 22:12:28 13681 [Note] InnoDB: Waiting for purge to start
2014-06-15 22:12:28 13681 [Note] InnoDB: 5.6.18 started; log sequence number 1625977
2014-06-15 22:12:28 13681 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2014-06-15 22:12:28 13681 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2014-06-15 22:12:28 13681 [Note] Binlog end
2014-06-15 22:12:28 13681 [Note] InnoDB: FTS optimize thread exiting.
2014-06-15 22:12:28 13681 [Note] InnoDB: Starting shutdown...
2014-06-15 22:12:30 13681 [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./

The latest information about MySQL is available on the web at

  http://www.

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

WARNING: Found existing config file /usr/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as /usr/my-new.cnf,
please compare it with your file and take the changes you need.

7.重启计算机

8.修改密码
 
(1)查看文件寻找密码

linux-hueu:~ # more .mysql_secret
# The random password set for the root user at Sun Jun 15 22:12:23 2014 (local t
ime): kg0F19KJRWcTPLU6

(2)登陆Mysql
 
[root@oracle11 ~]#mysql -u root -p
Enter password:
 
Welcome to the MySQLmonitor.  Commands end with ; or \g.
 
Your MySQLconnection id is 3
 
Server version:5.6.14-enterprise-commercial-advanced
 
 
 
Copyright (c) 2000,2013, Oracle and/or its affiliates. All rights reserved.
 
 
 
Oracle is aregistered trademark of Oracle Corporation and/or its
 
affiliates. Othernames may be trademarks of their respective
 
owners.
 
 
 
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
 
 
 
mysql>

(3)修改密码
 
mysql> setpassword for 'root'@'localhost' = password ('root');
 
Query OK, 0 rowsaffected (0.05 sec)
 
当然也可以使用脚本 /usr/bin/mysql_secure_installation进行交互式的修改mysql的root密码,如下:
 
[root@oracle11 ~]# /usr/bin/mysql_secure_installation
 
 
 
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
 
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
 
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
 
Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!
 
 
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
 
Remove anonymous users? [Y/n] n
 ... skipping.
 
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
 
Disallow root login remotely? [Y/n] n
 ... skipping.
 
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
 
Remove test database and access to it? [Y/n] n
 ... skipping.
 
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
 
Reload privilege tables now? [Y/n] n
 ... skipping.
 
 
 
 
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.
 
Thanks for using MySQL!
 
 
Cleaning up...


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多