为什么数据库一定要配合脚本语言(比方说mysql要php)?

为什么数据库一定要配合脚本语言(比方说mysql要php)?,第1张

因为脚本语言更容易编写或者在B/S,B/C,WEB环境下更容易发挥出优势.

这和数据库为什么要用没有多少关系.

当然连接MySQL用ASP也有,但是ASP本身不支持MYSQL的连接,所以导致用ASP连接MySQL的人十分的少.而PHP则本身自带连接函数,为了方便,所以就用PHP了.

当然不仅仅是PHP, JSP也有很多人用的.

如果您觉得文本对您有帮助,请打赏,谢谢。

新建执行脚本:mysql_install.sh,并添加执行权限

#!/bin/bash

#zhouyihua V0.1 2021.07.08

#For centos 7.0

# add DNS

echo "----------  Add DNS  --------"

echo "nameserver 8.8.8.8" >>/etc/resolv.conf

#stop firewall

systemctl stop firewalld

if [ $? -ne 0 ]then

    echo "Firewall stop failed"

else

    echo "Firewall stop success"

fi

#download mysql yum source

wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

#install mysql yum source

rpm -ivh mysql80-community-release-el7-3.noarch.rpm

#enable 5.7

sed -i '21s/enabled=0/enabled=1/g' /etc/yum.repos.d/mysql-community.repo

sed -i '21s/enabled=0/enabled=1/g' /etc/yum.repos.d/mysql-community.repo

#disable 8.0

sed -i '28s/enabled=1/enabled=0/g' /etc/yum.repos.d/mysql-community.repo

#install mysql

yum -y remove mariadb-libs

yum install -y mysql-community-server

#config mysql

echo "-----------  Config my.cnf  ----------"

sed -i '/\[mysqld\]/a\lower_case_table_names=1' /etc/my.cnf

sed -i '/\[mysqld\]/a\skip-grant-tables' /etc/my.cnf

#start mysql

echo "----------  Starting mysql service  ----------"

systemctl start mysqld.service

mysql -uroot -p123456  <<EOF

    use mysql

    update mysql.user set authentication_string=password('Oracle1234!@#$') where user='root'

EOF

echo "----------  Annotation skip grant tables in my.cnf    ----------"

sed -i 's/skip-grant-tables/\#skip-grant-tables/g' /etc/my.cnf

echo "----------  Restart mysql service  ----------"

systemctl restart mysqld.service

echo "----------  Grant all privileges  ----------"

mysql -uroot -p'Oracle1234!@#$'    --connect-expired-password -e "alter user 'root'@'localhost' identified by 'Oracle1234!@#$'"

mysql -u root -p'Oracle1234!@#$'  <<EOF

    use mysql

    GRANT ALL PRIVILEGES ON *.* TO 'iam'@'%' IDENTIFIED BY 'Oracle1234!@#$'

EOF


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7558857.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-07
下一篇 2023-04-07

发表评论

登录后才能评论

评论列表(0条)

保存