时间:2021-07-01 10:21:17 帮助过:12人阅读
[root@VM_32_234_centos tools]# rpm -ivh MySQL-server-5.6.21-1.linux_glibc2.5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-server rpm -ivh MySQL-devel-5.6.21-1.linux_glibc2.5.x86_64.rpm rpm -ivh MySQL-client-5.6.21-1.linux_glibc2.5.x86_64.rpm################# ########################################### [100%] 2014-09-29 15:01:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2014-09-29 15:01:50 30994 [Note] InnoDB: Using atomics to ref count buffer pool pages 2014-09-29 15:01:50 30994 [Note] InnoDB: The InnoDB memory heap is disabled 2014-09-29 15:01:50 30994 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2014-09-29 15:01:50 30994 [Note] InnoDB: Memory barrier is not used 2014-09-29 15:01:50 30994 [Note] InnoDB: Compressed tables use zlib 1.2.3 2014-09-29 15:01:50 30994 [Note] InnoDB: Using Linux native AIO 2014-09-29 15:01:50 30994 [Note] InnoDB: Using CPU crc32 instructions 2014-09-29 15:01:50 30994 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2014-09-29 15:01:50 30994 [Note] InnoDB: Completed initialization of buffer pool 2014-09-29 15:01:50 30994 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2014-09-29 15:01:50 30994 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2014-09-29 15:01:50 30994 [Note] InnoDB: Database physically writes the file full: wait... 2014-09-29 15:01:51 30994 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2014-09-29 15:01:52 30994 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2014-09-29 15:01:52 30994 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2014-09-29 15:01:52 30994 [Warning] InnoDB: New log files created, LSN=45781 2014-09-29 15:01:52 30994 [Note] InnoDB: Doublewrite buffer not found: creating new 2014-09-29 15:01:52 30994 [Note] InnoDB: Doublewrite buffer created 2014-09-29 15:01:52 30994 [Note] InnoDB: 128 rollback segment(s) are active. 2014-09-29 15:01:52 30994 [Warning] InnoDB: Creating foreign key constraint system tables. 2014-09-29 15:01:52 30994 [Note] InnoDB: Foreign key constraint system tables created 2014-09-29 15:01:52 30994 [Note] InnoDB: Creating tablespace and datafile system tables. 2014-09-29 15:01:52 30994 [Note] InnoDB: Tablespace and datafile system tables created. 2014-09-29 15:01:52 30994 [Note] InnoDB: Waiting for purge to start 2014-09-29 15:01:52 30994 [Note] InnoDB: 5.6.21 started; log sequence number 0 A random root password has been set. You will find it in ‘/root/.mysql_secret‘. 2014-09-29 15:01:53 30994 [Note] Binlog end 2014-09-29 15:01:53 30994 [Note] InnoDB: FTS optimize thread exiting. 2014-09-29 15:01:53 30994 [Note] InnoDB: Starting shutdown... 2014-09-29 15:01:54 30994 [Note] InnoDB: Shutdown completed; log sequence number 1625977 2014-09-29 15:01:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2014-09-29 15:01:54 31016 [Note] InnoDB: Using atomics to ref count buffer pool pages 2014-09-29 15:01:54 31016 [Note] InnoDB: The InnoDB memory heap is disabled 2014-09-29 15:01:54 31016 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2014-09-29 15:01:54 31016 [Note] InnoDB: Memory barrier is not used 2014-09-29 15:01:54 31016 [Note] InnoDB: Compressed tables use zlib 1.2.3 2014-09-29 15:01:54 31016 [Note] InnoDB: Using Linux native AIO 2014-09-29 15:01:54 31016 [Note] InnoDB: Using CPU crc32 instructions 2014-09-29 15:01:54 31016 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2014-09-29 15:01:54 31016 [Note] InnoDB: Completed initialization of buffer pool 2014-09-29 15:01:54 31016 [Note] InnoDB: Highest supported file format is Barracuda. 2014-09-29 15:01:54 31016 [Note] InnoDB: 128 rollback segment(s) are active. 2014-09-29 15:01:54 31016 [Note] InnoDB: Waiting for purge to start 2014-09-29 15:01:54 31016 [Note] InnoDB: 5.6.21 started; log sequence number 1625977 2014-09-29 15:01:54 31016 [Note] Binlog end 2014-09-29 15:01:54 31016 [Note] InnoDB: FTS optimize thread exiting. 2014-09-29 15:01:54 31016 [Note] InnoDB: Starting shutdown... 2014-09-29 15:01:56 31016 [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 [root@VM_32_234_centos tools]# rpm -ivh MySQL-devel-5.6.21-1.linux_glibc2.5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-devel ########################################### [100%] [root@VM_32_234_centos tools]# rpm -ivh MySQL-client-5.6.21-1.linux_glibc2.5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%] [root@VM_32_234_centos tools]#
上述三个命令在执行时,只有第一个命令执行的时间稍微长些,后面两个命令运行速度很快。
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
/usr/bin/mysql_install_db #初始化MySQL service mysql start #启动MySQL cat /root/.mysql_secret #查看root账号的初始密码,会出现下述所示信息
如:
[root@VM_32_234_centos storage]# service mysql start Starting MySQL. SUCCESS! [root@VM_32_234_centos storage]# cat /root/.mysql_secret # The random password set for the root user at Mon Sep 29 15:01:52 2014 (local time): PENFgcgkI8UnIKaE
[root@VM_32_234_centos storage]# mysql -u root -pPENFgcgkI8UnIKaE Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.6.21 Copyright (c) 2000, 2014, 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>
-- set password=password(‘123456‘); #更改MySQL密码,
mysql> set password=password(‘123456‘); Query OK, 0 rows affected (0.00 sec)
chkconfig mysql on
[root@VM_32_234_centos storage]# chkconfig mysql on [root@VM_32_234_centos storage]# chkconfig --list | grep mysql mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
上面打印出来的内容中,2~5为on就是开机启动了。
设置MySQL的字符集,配置MySQL表明不区分大小写(默认情况下,MySQL对表名区分大小写,列名不区分大小写)。在[mysqld]下面加入如下内容:
character_set_server=utf8 character_set_client=utf8 collation-server=utf8_general_ci lower_case_table_names=1 max_connections=1000
- /var/lib/mysql/ #数据库目录
- /usr/share/mysql #配置文件目录
- /usr/bin #相关命令目录 #启动脚本
1.修改 /etc/my.cnf 文件
vi /etc/my.cnf
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. #basedir = /storage/server/mysql-5.6.21-1/ datadir = /storage/server/mysql-5.6.21-1/data port = 3306 server_id = 2 socket = /storage/server/mysql-5.6.21-1/data/mysql.sock pid-file =/storage/server/mysql-5.6.21-1/data/VM_32_234_centos.pid # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
复制文件 /var/lib/mysql/ 到 /storage/server/mysql-5.6.21-1/data/
cp -R /var/lib/mysql/* /storage/server/mysql-5.6.21-1/data/
# service mysql restart Shutting down MySQL.. SUCCESS! Starting MySQL. SUCCESS!
Linux操作系统下MySQL的安装 --转
标签:engine not ica 技术 sed 压缩 lock class default