centos7.0 MYSQL rpm包的安装与其它的一些问题

来源:互联网 发布:杂牌液晶电视数据 编辑:程序博客网 时间:2024/05/17 01:04

1) 在http://dev.mysql.com/downloads/mysql下下载对应的rpm包。



2)  安装mysql

Rpm –ivh MySQL-client-5.6.23-1.linux_glibc2.5.x86_64.rpm

MySQL-devel-5.6.23-1.linux_glibc2.5.x86_64.rpm 

MySQL-server-5.6.23-1.linux_glibc2.5.x86_64.rpm

默认情况下,centos7版本会安装好mariadb-libs ,所有在安装mysql前,请将mariadb-libs

则要卸载已经安装好的maiadb-libs

#yum remove mariadb-libs*

卸载原有的mysql

删除对应的目录:

find / -name mysql

find / -name *mysql*

查找后,删除对应的文件和目录。

安装mysql

rpm –ivh MySQL-client-5.6.23-1.linux_glibc2.5.x86_64.rpm

rpm –ivh MySQL-devel-5.6.23-1.linux_glibc2.5.x86_64.rpm 

rpm –ivh MySQL-server-5.6.23-1.linux_glibc2.5.x86_64.rpm

安装完成后,输入mysql


说明mysql服务还没有启动,输入service mysql start启动mysql服务.


修改root密码:


---------------------------------------------------------------------------------------------------------------------------------

ARANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! You will find thatpassword in'/root/.mysql_secret'.

 

Youmust change that password on your first connect,no other statement but 'SET PASSWORD' willbe accepted.See the manual for the semantics of the 'password expired'

flag.

 

Also,the account for the anonymous user has been removed.

 

Inaddition, you can run:

 

  /usr/bin/mysql_secure_installation

 

whichwill also give you the option of removing the test database.This is stronglyrecommended for production servers.See the manual for more instructions.

 

Pleasereport any problems at http://bugs.mysql.com/

 

Thelatest information about MySQL is available on the web at

 

  http://www.mysql.com

 

SupportMySQL by buying support/licenses at http://shop.mysql.com

 

Newdefault config file was created as /usr/my.cnf and will be used by default by the server when youstart it.You may edit this file to change server settings

 

二 MySQL中文问题解决

 

1.在CentOS7中修改文件/usr/my.cnf,在[mysqld],[mysql],[client]下分别添加如下内容

 

[mysqld]

 

character_set_server= utf8

 

[mysql]

 

default-character-set=utf8

 

[client]

 

default-character-set=utf8

 

修改完成后,重启mysql服务,service mysql restart,然后进入mysql,

 

使用show variables like‘character%’查看MySQL的所有字符编码,除了character_set_filesystem和character_set_dir外,其余都位utf8编码。

 

附:netstat 命令

 



启动与停止mysql服务


3、自动启动

   1)察看mysql是否在自动启动列表中

   [root@test1local]# /sbin/chkconfig--list

   2)把MySQL添加到你系统的启动服务组里面去

   [root@test1local]# /sbin/chkconfig -- add mysql

   3)把MySQL从启动服务组里面删除。

   [root@test1local]# /sbin/chkconfig --del mysql


 

开机自启动mysqld服务,你可以这么来操作:vi /etc/rc.local在这个文件的最后加入如下语句:/etc/init.d/mysqld start这样就系统启动时mysql服务就起来了!

 

远程连接:

新安装的MySQL是默认不开户远程访问权限的,也就不能外部连接MySQL。这样对想远程调用MySQL的数据很不方便。下面我们来看下如何设置允许远程连接MySQL数据库。

登录MySQL

#mysql -uroot -p

如果无法登录可以使用find /-name mysql搜索mysql程序的路径,比如mysql程序路径为:/usr/local/mysql/bin/mysql,我们可以这样登录:

/usr/local/mysql/bin/mysql-uroot -p

执行如下命令:

#grant all privileges on *.* to 'root'@'%' identified by 'ROOT-PASSWORD';

#flush privileges;

# exit

好了这样你就可以用navicatmysql软件管理mysql了他可是个很棒的mysql管理客户端。

mysql-h 172.16.16.45 -P 3306 -u root –p  (大写P是端口,小写p是密码)


http://blog.csdn.net/czmchen/article/details/46645763 centos7下快速安装mysql

http://www.linuxidc.com/Linux/2015-01/111744.htm


0 0