fedora28安裝mysql(mariadb)
示例:安裝mysql
1、檢視是否安裝mysql
Yum list installed mysql*
Rpm –qa | grep mysql*
Locate mysql*
2、檢視yum源是否有mysql的安裝包
Yum list mysql*
3、安裝mysql客戶端
Yum install mysql
4、安裝mysql伺服器端
Yum install mysql-server
5、安裝mysql開發工具
Yum install mysql-devel
6、配置mysql字符集
/etc/my.cnf
Sudo gedit /etc/my.cnf
//最後一行新增 default –character-set = utf8
7、啟動mysql服務
Service mysqld start
/etc/init.d/mysqld start
新增一些配置:
檔案/etc/my.cnf
在[mysql]中新增
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
檔案/etc/my.cnf.d/client.cnf
在[client]中新增
default-character-set=utf8
檔案/etc/my.cnf.d/mysql-clients.cnf
在[mysql]中新增
default-character-set=utf8
錯誤:
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.'
解決:
1、關閉selinux和防火牆
setenforce 0 關閉selinux
systemctl stop firewalld.service 關閉防火牆
2、檢查配置/etc/my.cnf
3、檢視日誌:cat /var/log/mariadb/mariadb.log
錯誤:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
//sudo mysqld_safe --skip-grant-tables &
解決:
systemctl stop mariadb.service 先關閉
使用進入安全模式:
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
mysql -u root mysql
UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
FLUSH PRIVILEGES;
Quit
systemctl stop mariadb.service
systemctl start mariadb.service
如果發現啟動超時,檢視下程序是否存在,存在kill
ps uaxww | grep -i mysql