时间:2021-07-01 10:21:17 帮助过:3人阅读
7、启动mysql服务器
[root@localhost /]# /usr/local/mysql/support-files/mysql.server start
显示如下结果,说明数据库安装成功
如果出现如下提示信息
[root@yunlong etc]# /usr/local/mysql/support-files/mysql.server start
Starting MySQL.2019-12-14T06:17:04.144018Z mysqld_safe error: log-error set to ‘/var/log/mariadb/mariadb.log‘, however file don‘t exists. Create writable for user ‘mysql‘.
The server quit without updating PID file (/usr/local/mysql[FAILED]nlong.pid).
创建文件夹并授权后再次启动mysql服务器
[root@yunlong etc]# mkdir /var/log/mariadb [root@yunlong etc]# touch /var/log/mariadb/mariadb.log [root@yunlong etc]# chown -R mysql:mysql /var/log/mariadb/
8、添加软连接,并重启mysql服务
[root@yunlong /]# ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql [root@yunlong /]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
[root@yunlong /]# ln -s /usr/local/mysql/mysql.sock /tmp/mysql.sock [root@yunlong /]# service mysql restart
9、登录mysql,修改密码(密码为步骤5生成的临时密码)
[root@yunlong /]# mysql -u root -p
mysql>set password for root@localhost = password(‘yourpass‘);
10、开放远程连接
mysql>use mysql; msyql>update user set user.Host=‘%‘ where user.User=‘root‘; mysql>flush privileges;
11、设置开机自动启动
1、将服务文件拷贝到init.d下,并重命名为mysql [root@localhost /]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 2、赋予可执行权限 [root@localhost /]# chmod +x /etc/init.d/mysqld 3、添加服务 [root@localhost /]# chkconfig --add mysqld 4、显示服务列表 [root@localhost /]# chkconfig --list
参考链接:https://www.jianshu.com/p/276d59cbc529
Linux下安装mysql
标签:ring sha sql数据库 error tran led mysql strong chm