mysql 安装
【摘要】 centos 6下载安装包安装安装完的配置centos 7安装rpm包yum安装安装完的配置centos 6下载安装包下载[linux]# wget https://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar[linux]# tar -xvf MySQL-5.6.38-1.el6...
centos 6
下载安装包
下载
[linux]# wget https://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar[linux]# tar -xvf MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar[linux]# wget http://mirror.centos.org/centos/6/os/i386/Packages/libaio-0.3.107-10.el6.i686.rpm[linux]# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/numactl-2.0.9-2.el6.x86_64.rpm
这里注意:el6是针对centos6版本,7是真的centos7版本
删除旧包
[linux]# rpm -e --nodeps mysql-libs-5.1.*
安装
安装依赖包
rpm -ivh libaio-0.3.107-10.el6.i686.rpmrpm -ivh numactl-2.0.9-2.el6.x86_64.rpm
安装clint和server
[linux]# rpm -ivh MySQL-client-5.6.38-1.el6.x86_64.rpm [linux]# rpm -ivh MySQL-server-5.6.38-1.el6.x86_64.rpm
安装完的配置
启动mysql服务进程
[linux]# service mysql start
重置密码
[linux]# mysql_secure_installation
设置远程登陆
[linux]# mysql -uroot -p111111mysql> set password=password('111111'); Query OK, 0 rows affected (0.00 sec) mysql> grant all privileges on *.* to root@"%" identified by "111111"; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> update db set host = '%' where user = 'root'; Query OK, 0 rows affected (0.00 sec) Rows matched: 0 Changed: 0 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit; Bye
修改mysql的字符集
vi /usr/my.cnf
,文件末尾添加
character-set-server=utf8 lower_case_table_names=1max_connections=1000
重启mysql,
service mysql restart
检查字符集是否生效
[linux]# mysql -uroot -p111111mysql> show variables like 'character%';| character_set_client | utf8 | | character_set_connection | utf8 || character_set_database | utf8 | | character_set_filesystem | binary || character_set_results | utf8 | | character_set_server | utf8 || character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ |8 rows in set (0.00 sec)
centos 7
安装rpm包
安装带有可用的mysql5系列社区版资源的rpm包
# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm获取http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm准备中... ################################# [100%]正在升级/安装... 1:mysql-community-release-el7-5 ################################# [100%]
这个时候查看当前可用的mysql安装资源:
# yum repolist enabled | grep "mysql.*-community.*"mysql-connectors-community/x86_64 MySQL Connectors Community 17mysql-tools-community/x86_64 MySQL Tools Community 31mysql56-community/x86_64 MySQL 5.6 Community Server 199
yum安装
# yum -y install mysql-community-server...
安装完的配置
加入开机启动
# systemctl enable mysqld
启动mysql服务进程
# systemctl start mysqld
重置密码
# mysql_secure_installation
增加远程登陆权限
[root@localhost ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8Server version: 5.6.40 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye
创建数据库
CREATE DATABASE IF NOT EXISTS my_db default charset utf8 COLLATE utf8_general_ci;
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)