mariadb的安装和初始化
yum install mariadb-server.x86_64 -y
netstat -antlupe | grep mysql 查看mysql端口
添加skip-networking=1 跳过网络为了安全

systemctl restart mariadb 重启服务
mysql_secure_installation 设定用户密码,是否允许匿名用户登录,是否加载
mysql -uroot -p 123 root用户使用密码登录mysql
忘记mysql密码
systemctl stop mariadb.service 关闭数据库
mysqld_safe --skip-grant-tables & 把安全这个打入后台 登录不要密码
update mysql.user set Password=password('123456') where User='root';修改root密码为123456
ps aux | grep mysql 查看mysql相关进程
systemctl restart mariadb.service 重启服务
mysql -uroot -p 123456 root用户新密码登录
数据库的查询
SELECT 字段1,字段2,...from 表名称where 字段=‘字段值’; 查询数据
数据库的管理tuttuxinghau1
CREATE TABLE Linux (id int,name varchar(10) not null, password varchar(10) not null);
INSERT INTO Linux values(1,'Tom','123'); 插入数据
UPDATE linux SET Password=passwrd(‘xue’) where username=‘xue’;更改密码密文显示
ALTER TABLE com RENAME comptuer; 更改表名字
ALTER TABLE linux ADD class varchar(20); 添加class这一列
ALTER TABLE linux DROP class; 删除class
DELETE FROM redhat where username='xue';
CREATE USER xue@'localhost' identified by 'redhat'; 建立xue用户密码为redhat
GRANT SELECT,INSERT on xaut.* TO xue@localhost; 授权查找插入给xue用户xaut下面的所有表
SHOW GRANTS FOR xue@localhost; 查看用户授予的权限
REVOKE INSERT ON xaut.* FROM xue@localhost; 收回用户的插入权限
图形化管理
1安装并测试http服务
firewall-cmd --permanent --add-service=http
vim index.html hello world
2安装php及php-mysql

3下载安装phpMyAdmin
4在/mnt/www/html, tar jxf解压文件,重命名,进入phpMyAdmin 目录
cp config.sample.inc.php config.inc.php
tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
mv phpMyAdmin-3.4.0-all-languages/ mysqladmin
cp config.sample.inc.php config.inc.php
5.对config.inc.php进行修改
vim Documentation.txt

vim config.inc.php

6.下载php-mysql插件
yum install php-mysql.x86_64 -y
systemctl restart httpd.service
注意:问题一:安装过程中我在浏览器输入地址一直是文件,因为我没有重启httpd服务.
问题二:安装打开的只有文件,看到上图rpm -qa|grep php 的第一个镜像中没有需要自己下载
问题三:2002无法登录Mysql服务器编辑"mysqladmin/libraries"文件夹中config.default.php,
修改110行的localhost 为127.0.0.1,本地回环接口
[root@foundation61 libraries]
[root@foundation61 libraries]
/var/www/html/mysqladmin/libraries

问题四:1045无法登录Mysql服务器,依然修改上述文件中的false改为true,如果此时不能登录,尝试清除cookie


原文地址https://blog.csdn.net/weixin_40460156/article/details/81604999
网友评论