linux安装mysql

检测mysql是否安装

rpm -qa|grep mysql

删除mysql

rpm -e mysql-libs-5.1.73-7.el6.x86_64

如果出现如下错误,就需要强制卸载mysql

error: Failed dependencies:
	libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_7.1.x86_64
	libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_7.1.x86_64
	mysql-libs is needed by (installed) postfix-2:2.6.6-6.el6_7.1.x86_64

强制卸载mysql

rpm -ef mysql-libs-5.1.73-7.el6.x86_64 --nodeps

安装mysql服务器端

rpm -ivh MySQL-server-5.5.62-1.el6.x86_64.rpm

出现如下信息,说明安装成功

[root@luheng fengqing]# rpm -ivh MySQL-server-5.5.62-1.el6.x86_64.rpm 
warning: MySQL-server-5.5.62-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
190319 16:38:29 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
190319 16:38:29 [Note] /usr/sbin/mysqld (mysqld 5.5.62) starting as process 5442 ...
190319 16:38:29 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
190319 16:38:29 [Note] /usr/sbin/mysqld (mysqld 5.5.62) starting as process 5449 ...

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h luheng password 'new-password'

Alternatively you can run:
/usr/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.

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

安装Mysql客户端

rpm -ivh MySQL-client-5.5.62-1.el6.x86_64.rpm

 启动mysql

service mysql start

 连接MySQL

mysql -u root -p

创建MySQL用户配置

cp /usr/share/mysql/my-small.cnf /etc/my.cnf

修改myql编码并重启服务

打开/etc/my.cnf文件,在mysqld的首行位置加入

character_set_server=utf8

开启3306端口

给用户授权远程登录并刷新权限

mysql> grant all privileges on *.* to root@'%' identified by '123456' with grant option;

刷新权限

mysql> flush provileges;
 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值