/usr/local/mysql
2、下载MySQL压缩包
wget /get/Downloads/MySQL-5.7/mysql-5.7.11-Linux-glibc2.5-x86_64.tar.gz
3、解压并复制
tar -xvf mysql-5.7.11-Linux-glibc2.5-x86_64.tar.gzmv mysql-5.7.11-Linux-glibc2.5-x86_64/*/usr/local/mysql/
4、创建data目录
mkdir /usr/local/mysql/data
5、创建mysql用户组及其用户
groupadd mysql
useradd-r -g mysql mysql
6、初始化数据
[root@localhost mysql] ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
-01-20 02:47:35 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize-01-20 02:47:45 [WARNING] The bootstrap log isn‘t empty:
-01-20 02:47:45 [WARNING] -01-19T18:47:36.732678Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead-01-19T18:47:36.750527Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)-01-19T18:47:36.750560Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
7、复制配置文件到 /etc/f
cp -a ./support-files/my-f /etc/f (选择y)
8、MySQL的服务脚本放到系统服务中
cp -a ./support-files/mysql.server /etc/init.d/mysqld
修改f文件
# These are commonly set, remove the # and set as required.
basedir= /usr/local/mysql
datadir= /usr/local/mysql/data
port= 3306# server_id=.....
socket= /tmp/mysql.sock
character-set-server =utf8
# Remove leading # to set options mainly usefulforreporting servers.
# The server defaults are fasterfortransactions and fast SELECTs.
# Adjust sizes as needed, experiment tofindthe optimal values.
# join_buffer_size=128M
# sort_buffer_size=2M
# read_rnd_buffer_size= 2M
9、创建In
ln -s /usr/local/mysql/ /usr/bin/
10、启动服务
service mysqld start
11、初始化密码
mysql5.7会生成一个初始化密码,在root中.mysql_secret文件中。
[root@localhost ~]# cat /root/.mysql_secret
# Password setfor user ‘root@localhost‘ at -03-16 00:52:34ws;fmT7yh0CM
12、登录并修改密码
[root@localhost ~]# mysql -u root -p
alter user root@localhost identified by‘tiger‘;
flush privileges;
13、退出重新登录,完成
mysql>show databases;+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.11 sec)
OK
Linux下安装MySQL数据库(压缩包方式安装)
标签:修改usergroup改密码ini--report
本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉
本文系统来源:/xiaotao726/p/6562265.html