Linux安装Mysql实践和问题整理

1、Vmware 安装

下载地址:
http://www.downkr.com/soft/4103.html
破解方法:

序列号:
CV512-FAW91-085NP-DMXQX-QLHAF
AA7DU-APW15-H848Q-P5ZGZ-PCRC2
VU1N2-6DE5N-M8DLQ-AEMEV-XA2Z4
UV3NR-AMZ17-08EZP-9YQQE-MZAY8
GC75U-21E50-M8D5Q-K6YQX-W28V8

2、Centos 安装

1、配置安装 centos
参考文章:http://www.linuxidc.com/Linux/2014-02/97389.htm

3、Mysql

1、下载地址:http://dev.mysql.com/downloads/mysql/
2、Select Platform: Source Code
选择下载: Generic Linux (Architecture Independent), Compressed TAR Archive
3、 查询 linux 的 ip地址,使用 xftp 上传 mysql 安装包

shell>>ifconfig 
shell>>netstat -tnl

4、安装 cmake
下载地址:
https://cmake.org/download/
上传解压cmamke tar包

shell>>tar zxvf cmake-VERSION.tar.gz
shell>>cd cmake-version
shell>>./configure

    #如果报错,则是未安装开发工具导致
shell>>yum -y groupinstall 'Development tools'

    #如果遇到 Another app is currently holding the yum lock; waiting for it to exit...,强行解除锁定,然后你的yum就可以运行了
shell>>rm -rf /var/run/yum.pid 

    #再次运行
shell>>./configure
shell>>make && make install
shell>>which cmake  

5、安装mysql

# 预先设置工作组和系统用户
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
# 开始编译
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> cmake .

# 如果遇到缺少boost,则下载boost
下载地址:http://liquidtelecom.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
上传至 :/usr/local/boost

#如果遇到Curses library not found 问题
rm CmakeCache.txt
yum install ncurses-devel

shell> make
shell> make install

# 后期配置
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql    # Before MySQL 5.7.6

#使用 --initialize-insecure ,这样不会为root账号设置密码;使用--initialize会生成一个临时密码
#出现[ERROR] --initialize specified but the data directory has files in it. Aborting. 因为mysql会检查data目录,目录必须存在且不为空会报错,确保datadir目录下为空
shell> bin/mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql # MySQL 5.7.6 and up

shell> bin/mysql_ssl_rsa_setup              # MySQL 5.7.6 and up
shell> chown -R root .
shell> chown -R mysql data

#启动mysql服务,mysqld ended字样,则说明启动失败,此时需要查看日志文件,默认的位置是 data目录下的host_name.err。
shell> bin/mysqld_safe --user=mysql &

#修改临时密码,需先关闭mysql服务,新建文件,命名为mysql-init,上传至linux,重启mysql服务
内容:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
mysqld_safe --init-file=/home/me/mysql-init &

# mysql加入系统服务
shell> cp support-files/mysql.server /etc/init.d/mysql.server

#登录mysql,如果出现mysql 命令不存在
#方式一:添加至PATH
PATH=$PATH:/usr/local/mysql/bin;export PATH
#方式二:映射
shell> cd /usr/local/bin
ln -fs /usr/local/mysql/bin/mysql mysql
#登录mysql
shell> mysql -u root -p
mysql> show databases;
#开机自启动
shell> echo "/usr/local/mysql/bin/mysql_safe &" >>/etc/rc.local

参考文章:
http://wenku.baidu.com/link?url=k2F35w2Q5ja_AWQ-Rl5upjD6gZBXVCL_qGCqNLHjlGI63eaUm98iolDn0EhmInc1m9EHqN2Ke2UeHVU_2NVNrj1VQstmaFjq1si6pWMNibW

http://www.cnblogs.com/IceKernel/articles/2587274.html

http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html

http://www.ithao123.cn/content-4512198.html

http://blog.csdn.net/lee353086/article/details/40707001

http://my.oschina.net/itblog/blog/542005

http://blog.csdn.net/coroutines/article/details/7715621

http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

你可能感兴趣的:(mysql)