mysql5.5.37 安装_编译安装mysql-5.5.37

一、环境

系统:CentOS 6.4x64最小化安装

IP:192.168.3.54

二、安装基础软件包[root@httpd conf]# yum -y install make gcc-c++ cmake bison-devel  ncurses-devel

三、安装mysql

1.创建用户[root@httpd ~]# groupadd mysql

[root@httpd ~]# useradd -g mysql mysql -s /sbin/nologin

2.解压软件包[root@httpd ~]# tar xf mysql-5.5.37.tar.gz

3.编译配置参数#创建用来存放Mysql数据的目录

[root@httpd ~]# mkdir -p /data/mysql/data

[root@httpd ~]# cd mysql-5.5.37

[root@httpd mysql-5.5.37]# cmake > -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.37 > -DMYSQL_DATADIR=/data/mysql/data > -DSYSCONFDIR=/etc > -DWITH_MYISAM_STORAGE_ENGINE=1 > -DWITH_INNOBASE_STORAGE_ENGINE=1 > -DWITH_MEMORY_STORAGE_ENGINE=1 > -DWITH_READLINE=1 > -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock > -DMYSQL_TCP_PORT=3306 > -DENABLED_LOCAL_INFILE=1 > -DWITH_PARTITION_STORAGE_ENGINE=1 > -DEXTRA_CHARSETS=all > -DDEFAULT_CHARSET=utf8 > -DDEFAULT_COLLATION=utf8_general_ci

[root@httpd mysql-5.5.37]# make && make install

4.数据目录初始化[root@httpd mysql-5.5.37]# cd /usr/local/mysql-5.5.37/

[root@httpd mysql-5.5.37]# scripts/mysql_install_db --datadir=/data/mysql/data/ --user=mysql --basedir=/usr/local/mysql-5.5.37/

Installing MySQL system tables...

OK

Filling help tables...

OK                            #到这里显示的有2个OK表示成功

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/local/mysql-5.5.37//bin/mysqladmin -u root password ‘new-password‘

/usr/local/mysql-5.5.37//bin/mysqladmin -u root -h httpd password ‘new-password‘

Alternatively you can run:

/usr/local/mysql-5.5.37//bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd /usr/local/mysql-5.5.37/ ; /usr/local/mysql-5.5.37//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd /usr/local/mysql-5.5.37//mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

5.复制mysql配置文件[root@httpd mysql-5.5.37]# cp -rf support-files/my-large.cnf /etc/my.cnf

6.创建启动脚本[root@httpd mysql-5.5.37]# cp support-files/mysql.server /etc/init.d/mysqld

[root@httpd mysql-5.5.37]# chmod +x /etc/init.d/mysqld

[root@httpd mysql-5.5.37]# /etc/init.d/mysqld start

Starting MySQL.. SUCCESS!

[root@httpd mysql-5.5.37]# netstat -anpt |grep mysql

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      21814/mysqld

7.连接到数据库[root@httpd ~]# which mysql

/usr/bin/which: no mysql in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

#配置软连接

[root@httpd ~]# ln -s /usr/local/mysql-5.5.37/ /usr/local/mysql

[root@httpd ~]# ln -s /usr/local/mysql-5.5.37/bin/* /usr/sbin/

[root@httpd ~]# which mysql

/usr/sbin/mysql

连接到数据库

[root@httpd ~]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.37-log Source distribution

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>

#默认的情况下是没有密码的,设置root账号的密码,设置密码是ly36843

mysql> update user set password=password(‘lyao36843‘) where host="localhost" and user="root";

Query OK, 1 row affected (0.03 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> update user set password=password(‘lyao36843‘) where host="127.0.0.1" and user="root";

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> select user,host,password from mysql.user;

+------+-----------+-------------------------------------------+

| user | host      | password                                  |

+------+-----------+-------------------------------------------+

| root | localhost | *B181A5BCA7C882221F5B8F6F9657AE71FF67EDDB |

| root | httpd     |                                           |

| root | 127.0.0.1 | *B181A5BCA7C882221F5B8F6F9657AE71FF67EDDB |

| root | ::1       |                                           |

|      | localhost |                                           |

|      | httpd     |                                           |

+------+-----------+-------------------------------------------+

6 rows in set (0.00 sec)

#清除mysql用户表中不安全的用户

mysql> delete from mysql.user where password=‘‘;

Query OK, 4 rows affected (0.03 sec)

mysql> select user,host,password from mysql.user;

+------+-----------+-------------------------------------------+

| user | host      | password                                  |

+------+-----------+-------------------------------------------+

| root | localhost | *B181A5BCA7C882221F5B8F6F9657AE71FF67EDDB |

| root | 127.0.0.1 | *B181A5BCA7C882221F5B8F6F9657AE71FF67EDDB |

+------+-----------+-------------------------------------------+

2 rows in set (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

#退出数据库重新连接

[root@httpd ~]# mysql -u root -p -h 127.0.0.1

Enter password:                 #输入之前设置的mysql数据库密码

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.5.37-log Source distribution

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>

8.最后将mysql添加到开机自动启动[root@httpd ~]# chkconfig --add mysqld

[root@httpd ~]# chkconfig mysqld on

[root@httpd ~]# chkconfig mysqld --list

mysqld         0:off1:off2:on3:on4:on5:on6:off

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装Win10和MySQL 5.5.37时,可能会遇到安装向导(wizard)无法运行的问题。这个问题可能由以下几个原因引起: 1. 兼容性问题:MySQL 5.5.37可能不完全兼容Windows 10操作系统。在这种情况下,您可以尝试通过在兼容性模式下运行安装向导来解决问题。右键点击安装向导的可执行文件,选择“属性”,然后切换到“兼容性”选项卡,并选择一个与您的操作系统相对应的兼容模式。然后再次运行向导,看看问题是否解决。 2. 程序冲突:您的计算机上可能已经安装了其他与MySQL冲突的程序。这些程序可能会干扰安装向导的正常运行。在进行MySQL安装之前,我们建议关闭所有可能干扰安装向导的程序,如杀毒软件、防火墙等。然后重新运行安装向导,查看问题是否解决。 3. 安装文件损坏:安装向导的安装文件可能已损坏。在这种情况下,您可以重新下载MySQL 5.5.37并尝试使用新的安装文件进行安装。确保您从官方网站或可信赖的来源下载安装文件,以确保其完整性。 4. 硬件问题:最后,安装向导无法运行的原因可能与您的计算机硬件有关。如果您的计算机硬件不满足MySQL的最低要求,安装向导可能无法正常运行。请确保您的计算机硬件符合MySQL的要求,并尝试在满足这些要求的计算机上进行安装。 希望以上建议可以帮助您解决安装向导无法运行的问题。如果问题仍然存在,请尝试在MySQL官方论坛或社区中咨询其他用户,寻求更多帮助和解决方案。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值