加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

linux系统应该怎样组装mysql5.7.21版本数据库

发布时间:2023-08-12 14:57:48 所属栏目:MySql教程 来源:
导读:主要给大家带来linux系统应该如何安装mysql5.7.21版本数据库,所讲到的知识,与书籍略有不同,都是亿速云专业技术人员在与用户接触过程中,总结出来的,具有一定的经验分享价值,希望给广大读者带来帮助。

1、下
主要给大家带来linux系统应该如何安装mysql5.7.21版本数据库,所讲到的知识,与书籍略有不同,都是亿速云专业技术人员在与用户接触过程中,总结出来的,具有一定的经验分享价值,希望给广大读者带来帮助。
 
1、下载数据库版本
 
mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
 
2、解压
 
tar -zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
 
mv mysql-5.7.21-linux-glibc2.12-x86_64 mysql
 
3、 初始化数据库
 
5.7与以前的版本初始化有所不同
 
mkdir /ghca/mysql/data
 
mkdir /ghca/mysql/log
 
安装numactl    yum  install    numactl
 
./mysqld --initialize --user=mysql --basedir=/ghca/mysql/ --datadir=/ghca/mysql/data
 
2018-03-29T06:44:18.994928Z 0 [Warning] [MY-011070] Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it is deprecated and will be removed in a future release.
 
2018-03-29T06:44:18.995070Z 0 [System] [MY-010116] /ghca/mysql/bin/mysqld (mysqld 8.0.4-rc) starting as process 23100 ...
 
2018-03-29T06:44:23.952948Z 0 [Warning] [MY-010068] CA certificate ca.pem is self signed.
 
2018-03-29T06:44:24.389231Z 5 [Note] [MY-010454] A temporary password is generated for root@localhost: Y%7923Moc7dd  这是root密码
 
复制mysql.server到/etc/init.d/
 
cp support-files/mysql.server  /etc/init.d/mysql
 
修改配置文件
 
cat my.cnf
 
[client]
 
port = 3306
 
socket =/ghca/mysql/mysql.sock
 
[mysqld]
 
port = 3306
 
user = mysql
 
character-set-server = utf8
 
#default_storage_engine = innodb
 
log_timestamps = SYSTEM
 
socket =/ghca/mysql/mysql.sock
 
basedir =/ghca/mysql/
 
datadir =/ghca/mysql/data
 
pid-file =/ghca/mysql/data/mysql.pid
 
max_connections = 1000
 
max_connect_errors = 1000
 
table_open_cache = 1024
 
max_allowed_packet = 128M
 
open_files_limit = 65535
 
#####====================================[innodb]==============================
 
innodb_buffer_pool_size = 1024M
 
innodb_file_per_table = 1
 
innodb_write_io_threads = 4
 
innodb_read_io_threads = 4
 
innodb_purge_threads = 2
 
innodb_flush_log_at_trx_commit = 1
 
innodb_log_file_size = 512M
 
innodb_log_files_in_group = 2
 
innodb_log_buffer_size = 16M
 
innodb_max_dirty_pages_pct = 80
 
innodb_lock_wait_timeout = 30
 
innodb_data_file_path=ibdata1:1024M:autoextend
 
#####====================================[log]==============================
 
log_error =/ghca/mysql/log/mysql-error.log
 
slow_query_log = 1
 
long_query_time = 1
 
slow_query_log_file =/ghca/mysql/log/mysql-slow.log
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
 
4、 添加开机自动启动
 
chkconfig --add mysql
 
chkconfig mysql on
 
service mysql start
 
5、不知道root密码操作步骤
 
1、停止mysql
 
2、./mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
 
3、登录mysql
 
mysql
 
mysql> update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost';
 
Query OK, 1 row affected, 1 warning (0.00 sec)
 
Rows matched: 1  Changed: 1  Warnings: 1
 
mysql> flush privileges;
 
6、数据库安装完成之后,无法启动
 
service mysql start
 
Starting MySQL. ERROR! The server quit without updating PID file (/ghca/mysql/data/mysql.pid).
 
修改my.cnf文件权限
 
chmod 775 /ghca/mysql/my.cnf
 
service mysql start
 
my_print_defaults: [Warning] World-writable config file '/ghca/mysql/my.cnf' is ignored.
 
Starting MySQL.my_print_defaults: [Warning] World-writable config file '/ghca/mysql/my.cnf' is ignored.
 
my_print_defaults: [Warning] World-writable config file '/ghca/mysql/my.cnf' is ignored.
 
SUCCESS!
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章