关闭

linux 下mysql 5.7.9tar 包安装

3900人阅读 评论(0) 收藏 举报
分类:

1、软件下载

登录到 http://dev.mysql.com/downloads/mysql/  ,选择对应的版本进行下载。



2、创建mysql 用户


[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -g mysql mysql
[root@localhost ~]# passwd mysql

将tar 包拷贝到mysql的home 目录下,进行解压后得到的目录 重命名为 mysql-5.7.9 


3、安装数据库

进入 /home/mysql/mysql-5.7.9/bin 

[mysql@localhost bin]$ ./mysql_install_db --user=mysql --basedir=/home/mysql/ --datadir=/home/mysql/data
2015-11-19 06:49:00 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2015-11-19 06:49:07 [ERROR]   The bootstrap log isn't empty:
2015-11-19 06:49:07 [ERROR]   2015-11-19T14:49:01.852039Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
2015-11-19T14:49:01.868000Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2015-11-19T14:49:01.868056Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2015-11-19T14:49:01.888730Z 0 [ERROR] Can't read from messagefile '/usr/share/mysql/english/errmsg.sys'

提示mysql_install_db 命令已弃用,使用mysqld 


[mysql@localhost bin]$ ./mysqld --user=mysql --basedir=/home/mysql/ --datadir=/home/mysql/data
2015-11-19T14:50:18.145225Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2015-11-19T14:50:18.145526Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2015-11-19T14:50:18.797964Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-11-19T14:50:18.798019Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2015-11-19T14:50:18.798053Z 0 [Note] ./mysqld (mysqld 5.7.9) starting as process 3578 ...
2015-11-19T14:50:18.798104Z 0 [ERROR] Can't find error-message file '/home/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2015-11-19T14:50:18.802586Z 0 [Note] InnoDB: PUNCH HOLE support not available
2015-11-19T14:50:18.802645Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-11-19T14:50:18.802656Z 0 [Note] InnoDB: Uses event mutexes
2015-11-19T14:50:18.802665Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2015-11-19T14:50:18.802674Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-11-19T14:50:18.802682Z 0 [Note] InnoDB: Using Linux native AIO
2015-11-19T14:50:18.803153Z 0 [Note] InnoDB: Number of pools: 1
2015-11-19T14:50:18.803868Z 0 [Note] InnoDB: Using CPU crc32 instructions
2015-11-19T14:50:18.843406Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2015-11-19T14:50:18.860507Z 0 [Note] InnoDB: Completed initialization of buffer pool
2015-11-19T14:50:18.864349Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2015-11-19T14:50:18.878937Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2015-11-19T14:50:18.901395Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2015-11-19T14:50:18.901629Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2015-11-19T14:50:18.943961Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2015-11-19T14:50:18.945376Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2015-11-19T14:50:18.945403Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2015-11-19T14:50:18.952368Z 0 [Note] InnoDB: 5.7.9 started; log sequence number 2471242
2015-11-19T14:50:18.974882Z 0 [Note] InnoDB: Loading buffer pool(s) from /home/mysql/data/ib_buffer_pool
2015-11-19T14:50:18.976665Z 0 [Note] InnoDB: Buffer pool(s) load completed at 151119  6:50:18
2015-11-19T14:50:18.978694Z 0 [Note] InnoDB: not started
2015-11-19T14:50:18.978878Z 0 [Note] Plugin 'FEDERATED' is disabled.
2015-11-19T14:50:18.983412Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2015-11-19T14:50:18.984289Z 0 [Warning] CA certificate ca.pem is self signed.
2015-11-19T14:50:19.003696Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2015-11-19T14:50:19.021246Z 0 [Note] IPv6 is available.
2015-11-19T14:50:19.021291Z 0 [Note]   - '::' resolves to '::';
2015-11-19T14:50:19.021299Z 0 [Note] Server socket created on IP: '::'.
2015-11-19T14:50:19.037949Z 0 [ERROR] Could not create unix socket lock file /var/lib/mysql/mysql.sock.lock.
2015-11-19T14:50:19.037976Z 0 [ERROR] Unable to setup unix socket lock file.
2015-11-19T14:50:19.037982Z 0 [ERROR] Aborting

2015-11-19T14:50:19.038004Z 0 [Note] Binlog end
2015-11-19T14:50:19.038084Z 0 [Note] Shutting down plugin 'ngram'
2015-11-19T14:50:19.038094Z 0 [Note] Shutting down plugin 'ARCHIVE'
2015-11-19T14:50:19.038098Z 0 [Note] Shutting down plugin 'partition'
2015-11-19T14:50:19.038102Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2015-11-19T14:50:19.038106Z 0 [Note] Shutting down plugin 'CSV'
2015-11-19T14:50:19.038112Z 0 [Note] Shutting down plugin 'MEMORY'
2015-11-19T14:50:19.038118Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2015-11-19T14:50:19.038124Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2015-11-19T14:50:19.038128Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2015-11-19T14:50:19.038131Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2015-11-19T14:50:19.038135Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2015-11-19T14:50:19.038138Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2015-11-19T14:50:19.038142Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2015-11-19T14:50:19.038145Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2015-11-19T14:50:19.038149Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2015-11-19T14:50:19.038152Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2015-11-19T14:50:19.038155Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2015-11-19T14:50:19.038159Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2015-11-19T14:50:19.038162Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2015-11-19T14:50:19.038165Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2015-11-19T14:50:19.038168Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2015-11-19T14:50:19.038172Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2015-11-19T14:50:19.038175Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2015-11-19T14:50:19.038179Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2015-11-19T14:50:19.038182Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2015-11-19T14:50:19.038186Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2015-11-19T14:50:19.038189Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2015-11-19T14:50:19.038192Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2015-11-19T14:50:19.038196Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2015-11-19T14:50:19.038199Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2015-11-19T14:50:19.038203Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2015-11-19T14:50:19.038206Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2015-11-19T14:50:19.038210Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2015-11-19T14:50:19.038213Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2015-11-19T14:50:19.038217Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2015-11-19T14:50:19.038221Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2015-11-19T14:50:19.038224Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2015-11-19T14:50:19.038228Z 0 [Note] Shutting down plugin 'InnoDB'
2015-11-19T14:50:19.038317Z 0 [Note] InnoDB: FTS optimize thread exiting.
2015-11-19T14:50:19.038421Z 0 [Note] InnoDB: Starting shutdown...
2015-11-19T14:50:19.151526Z 0 [Note] InnoDB: Dumping buffer pool(s) to /home/mysql/data/ib_buffer_pool
2015-11-19T14:50:19.152515Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 151119  6:50:19
2015-11-19T14:50:20.802442Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2471261
2015-11-19T14:50:20.811473Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2015-11-19T14:50:20.811528Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2015-11-19T14:50:20.811690Z 0 [Note] Shutting down plugin 'MyISAM'
2015-11-19T14:50:20.811730Z 0 [Note] Shutting down plugin 'sha256_password'
2015-11-19T14:50:20.811739Z 0 [Note] Shutting down plugin 'mysql_native_password'
2015-11-19T14:50:20.812061Z 0 [Note] Shutting down plugin 'binlog'
2015-11-19T14:50:20.813161Z 0 [Note] 


4、配置文件

[root@localhost ~]# cd /home/mysql/mysql-5.7.9/support-files/
[root@localhost support-files]# cp my-default.cnf /etc/my.cnf 
cp: overwrite `/etc/my.cnf'? yes
[root@localhost support-files]# cp mysql.server /etc/init.d/mysql


vim /etc/init.d/mysql   

basedir=/home/mysql/
datadir=/home/mysql/data

5、配置环境变量

[mysql@localhost ~]$ vi .bash_profile 
PATH=$PATH:$HOME/bin
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export MYSQL_HOME="/home/mysql/mysql-5.7.9"
export PATH="$PATH:$MYSQL_HOME/bin"
~


6、添加开机启动服务

chkconfig --add mysql
chkconfig mysql on

7、启动mysql 

[root@localhost support-files]# su - mysql
[mysql@localhost ~]$ service mysql start
/etc/init.d/mysql: line 256: my_print_defaults: command not found
Starting MySQL ERROR! Couldn't find MySQL server (/home/mysql//bin/mysqld_safe)

启动报错了,原来是编辑/etc/init.d/mysql  文件出错了,修改为下面

vim /etc/init.d/mysql   

basedir=/home/mysql/mysql-5.7.9
datadir=/home/mysql/data

[mysql@localhost ~]$ service mysql start
Starting MySQL. SUCCESS! 
再次启动成功


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:147026次
    • 积分:3189
    • 等级:
    • 排名:第11394名
    • 原创:163篇
    • 转载:87篇
    • 译文:4篇
    • 评论:5条
    最新评论