时间:2021-07-01 10:21:17 帮助过:56人阅读
4、创建mysql用户并给mysql用户赋予mysql程序安装目录的权限
useradd mysql -s /sbin/nologin chown -R mysql:mysql /usr/local/mysql
mkdir /usr/local/mysql/data
chown -R mysql:mysql /usr/local/mysql/data
5、为mysql创建自带的数据库和表
cd /usr/local/mysql
bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
6、注册为服务
cp support-files/mysql.server /etc/init.d/mysql
7、创建etc/my.cnf
cp support-files/my-default.cnf /etc/my.cnf
8、将mysql加入环境变量
[root@ rhel5~]# vi /root/.bash_profile 在PATH=$PATH:$HOME/bin添加参数为: PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib [root@ rhel5~]#source /root/.bash_profile
9、设置默认密码
mysql 5.7在安装后会默认生成一个随机密码存放在/root/.mysql_secret 查看改密码使用 cat /root/.mysql_secret 随后修改密码 mysqladmin -u root -p‘旧密码‘ password ‘新密码‘
10、启动mysql
systemctl start mysql
11、设置mysql远程访问
mysql -u root -proot GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘你的密码‘ WITH GRANT OPTION; FLUSH PRIVILEGES;
12、设置防火墙添加端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
13、设置myqsl开机启动
chkconfig –-add mysql
chkconfig mysql on
centos通过源码安装mysql(可用于树莓派安装)
标签:span linu 程序 ash ide support .gz 开机启动 public