linux mysql 5.7的安装配置教程
1、添加mysq组和用户
groupadd mysql
useradd -r -g mysql mysql
2、解压mysql安装包(mysql-5.7.18-linux-glibc2.5-x86_64.tar)
tar -xvfmysql-5.7.18-linux-glibc2.5-x86_64.tar
tar -zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
3、重命名
mv mysql-5.7.18-linux-glibc2.5-x86_64 mysql
4、更改mysql文件夹所属的组合用户
chown -R mysql /usr/local/mysql/
chgrp -R mysql /usr/local/mysql/
5、进入mysql目录 初始化mysql
bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
6、配置mysql
vi /etc/my.cnf 将附件里的内容复制粘贴进去
附件内容如下:
[mysqld] sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES basedir = /usr/local/mysql datadir = /usr/local/mysql/data port = 3306 socket = /tmp/mysql.sock character-set-server=utf8 skip-grant-tables back_log = 300 max_connections = 3000 max_connect_errors = 50 table_open_cache = 4096 max_allowed_packet = 32M #binlog_cache_size = 4M max_heap_table_size = 128M read_rnd_buffer_size = 16M sort_buffer_size = 16M join_buffer_size = 16M thread_cache_size = 16 query_cache_size = 128M query_cache_limit = 4M ft_min_word_len = 8 thread_stack = 512K transaction_isolation = REPEATABLE-READ tmp_table_size = 128M #log-bin=mysql-bin long_query_time = 6 server_id=1 innodb_buffer_pool_size = 1G innodb_thread_concurrency = 16 innodb_log_buffer_size = 16M innodb_log_file_size = 512M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 innodb_file_per_table = on [mysqldump] quick max_allowed_packet = 32M [mysql] no-auto-rehash default-character-set=utf8 safe-updates [myisamchk] key_buffer = 16M sort_buffer_size = 16M read_buffer = 8M write_buffer = 8M [mysqlhotcopy] interactive-timeout [mysqld_safe] open-files-limit = 8192
注意事项:
basedir = /usr/local/mysql datadir = /usr/local/mysql/data socket = /tmp/mysql.sock
这几个目录或文件如果不存在,你需要主动创建好,否则会报错。
这个配置文件中有这么一句话skip-grant-tables 是跳过权限和密码验证的;等后面修改完root密码时,需要把这句话注释掉。
7、mysql命令
cp -a /usr/local/mysql/suport-files/mysql.server /etc/init.d/mysql
service mysql start 启动服务
service mysql status 查看mysql状态
service mysql stop 停止服务
service mysql restart 重启服务
8、启动服务 登入系统
./usr/local/mysql/bin/mysql -uroot -p
9、修改root用户密码
//查看所有用户 use mysql; select * from user \G;
UPDATE mysql.user SET authentication_string = PASSWORD('mypassword') WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
10、退出mysql
exit
下一篇: Oracle数据库中的基本建库操作详解
推荐阅读
-
Linux中JDK安装配置教程
-
mysql8.0.11 winx64手动安装配置教程
-
MySQL5.7.20解压版安装和修改root密码的教程
-
mysql 5.7.21 解压版安装配置方法图文教程
-
Windows server 2008 r2下MySQL5.7.17 winx64安装版配置方法图文教程
-
MySql 5.7.17压缩包免安装的配置过程图解
-
linux下mysql的安装步骤
-
win10 下安装mysql服务器社区版本mysql 5.7.22 winx64的图文教程
-
mysql8.0.11 winx64安装配置方法图文教程(win10)
-
Mysql5.7.17 winx64.zip解压缩版安装配置图文教程