linux下安装mysql5.6

随着mysql越来越受欢迎,但对于刚接触linux系统的人来说,安装mysql比在windows下痛苦的多,希望这个文章等够帮助到各位,以下是主要的安装步骤:

1、官网下载mysql安装包:wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.20.tar.gz

2、下载cmake安装包:wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

3、解压cmake:tar xzvf cmake-2.8.4.tar.gz

4、cd cmake-2.8.4

5、./bootstrap

6、gmake

7、gmake install

8、解压Mysql:tar xzvf mysql-5.6.20.tar.gz

9、cd mysql-5.6.20

10、cmake .

11、如果cmake报错:– Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:83 (MESSAGE):
Curses library not found. Please install appropriate package,

remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:127 (FIND_CURSES)
cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:257 (MYSQL_CHECK_READLINE)

— Configuring incomplete, errors occurred!

请采用 #yum -y install ncurses-devel 解决,并删除rm -rf CMakeCache.txt,重新cmake .

12、make && make install

13、添加服务,拷贝服务脚本到init.d目录,并设置开机启动:cp support-files/mysql.server /etc/init.d/mysql

14、创建mysql登录用户:insert into mysql.user(Host,User,Password) values(‘localhost’,’root’,password(‘123456987’)); flush privileges;

15、登录mysql:/usr/local/mysql/bin/mysql -u root -p; 输入密码

16、开启外网远程链接:update user set host = ‘%’ where host = ‘localhost’; flush privileges; 重启mysql:/etc/init.d/mysqld restart;

17、如果安装完成后,启动失败,请注意 /etc/my.cnf 下的配置,以及当前mysql的文件夹是否mysql用户和权限,如果不是请先添加mysql组和mysql用户,最后执行命令:chown -R mysql:mysql /usr/local/mysql 修改  11


1 星2 星3 星4 星5 星 (2 人评价, 平均分: 5.00 / 5)
Loading...

发表评论