Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

手动部署mysql——软件包安装[0]

Posted on 2023年11月14日 by

本篇是《手动部署nginx——软件包安装》的续篇,因此设置是继承的。

  • 安装mysql
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum update
yum -y install mysql-community-server mysql-community-devel
  • 获取安装的mysql版本和位置
mysql -V

whereis mysql

  • 获取mysql的配置文件
grep socket /etc/my.cnf
  • 第一次启动mysql服务
systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld

  • 获取临时密码和修改密码
grep 'temporary password' /var/log/mysqld.log

  • 修改mysql密码
mysql -u root -p

出现以下情况:

 

  • 解决MySQL输入密码出现ERROR 1045
sysytemctl stop myslqd
nano /etc/my.cnf

在文件结尾添加

skip_grant_tables

跳过权限检查

  • 第二次启动mysql
systemctl restart mysqld
systemctl status mysqld
  • 再次修改mysql密码
mysql -u root -p

输入零时密码

#将数据库切换至mysql库

mysql> USE mysql;

#修改密码

update mysql.user set authentication_string=password('root') where user='root' ;

#通过以上更新命令,将password括号后面的root更改成你常用的密码(即数据库密码)。

#刷新MySQL权限相关的表

mysql> flush privileges;
mysql> exit;
  • 第三次启动mysql
systemctl restart mysqld
systemctl status mysqld
  • mysql数据检查
mysql -u root -p

提示输入密码,密码为root

mysql> show databases;

mysql> status

  • 修改数据库的编码格式
nano /etc/my.cnf

在文件最后添加character_set_server=utf8

效果如下:

重启mysql使得设置生效

systemctl restart mysqld

进入mysql检查

mysql -u root -p

提示输入密码,密码为root

mysql> status

  • 获取mysql的启动配置文件my.cnf位置和修改
mysql --help|grep 'my.cnf'

 

  • 检查数据库的网络状态
netstat -antlp |grep mysql

参考资料:

  1. https://cloud.tencent.com/developer/article/1617853

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT