linux涓嬪畨瑁卪ysql
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux涓嬪畨瑁卪ysql相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/fedora' title='fedora'>fedora
x86_64 rem 娉ㄦ剰 top tor conf1.1. 妫€娴嬫槸鍚﹀凡缁忓畨瑁呬簡mysql
rpm -qa | grep mysql
濡傛灉宸茬粡瀹夎浜嗭紝灏嗗叾鍗歌浇锛屽锛?/p>
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
1.2. 瀹夎mysql
1銆乵kdir /usr/local/src/mysql
2銆乧d /usr/local/src/mysql
3銆乼ar -xvf MySQL-5.6.22-1.el6.i686.rpm-bundle.tar(瑙e帇)
4銆佸畨瑁卻erver
rpm -ivh MySQL-server-5.6.22-1.el6.i686.rpm
鍑洪敊锛?/p>
瀹夎渚濊禆锛歽um -y install libaio.so.1 libgcc_s.so.1 libstdc++.so.6
闇€瑕佸崌绾ibstdc++-4.4.7-4.el6.x86_64
yum update libstdc++-4.4.7-4.el6.x86_64
5銆佸畨瑁呬腑锛?/p>
6銆佸畨瑁卌lient
瀹夎渚濊禆锛歽um -y install libncurses.so.5 libtinfo.so.5
7銆佹煡璇ysq鏈嶅姟杩愯鐘舵€?/p>
鏈嶅姟鏈惎鍔ㄣ€?/p>
8銆?nbsp;鍚姩mysql鏈嶅姟
service mysql start
9銆佷娇鐢╮oot璐﹀彿鐧诲綍mysql
鎻愮ず锛?/p>
鍦ㄥ畨瑁卪ysql server鏃舵湁鍙ユ彁绀猴細
1銆?nbsp;娉ㄦ剰锛氳繖涓瘑鐮佹槸涓嶅畨鍏ㄧ殑锛屾墍鏈夐渶瑕佷慨鏀瑰垵濮嬪瘑鐮併€?/p>
2銆?nbsp;浣跨敤瀵嗙爜鐧诲綍mysql璐﹀彿锛歮ysql -uroot -p
3銆?nbsp;淇敼root瀵嗙爜锛歋ET PASSWORD = PASSWORD(鈥?23456鈥?;
2.3 绯荤粺鍚姩鏃惰嚜鍔ㄥ惎鍔╩ysql鏈嶅姟
娉ㄦ剰锛?/p>
centos7寮€濮嬩娇寰椾互寰€鑰佺増鏈郴缁熸湇鍔$殑/etc/init.d鐨勫惎鍔ㄨ剼鏈殑鏂瑰紡灏辨鏀瑰彉锛屽湪centos7涓墍鏈夊鏈嶅姟鐨勭鐞嗛兘闆嗕腑鍒颁簡systemctl褰撲腑銆?br>systemctl鏄竴涓郴缁熺鐞嗗畧鎶よ繘绋嬨€佸伐鍏峰拰搴撶殑闆嗗悎锛岀敤浜庡彇浠d互寰€鐨凷ystem V銆乻ervice鍜宑hkconfig鍛戒护銆?br>
鍒涘缓鐢ㄤ簬鍚姩MySQL鐨勯厤缃枃浠?br>[[email protected] ~]# touch /usr/lib/systemd/system/mysqld.service
[[email protected] ~]# cd /usr/lib/systemd/system
缂栬緫mysqld.service鏂囦欢锛屽姞鍏ュ涓嬪唴瀹?
[[email protected] system]# vi mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/opt/mysql-5.7.18/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
淇濆瓨閫€鍑?br>
澶囨敞:ExecStart=/opt/mysql-5.7.18/bin/mysqld (姝ゅ璇峰搴斾慨鏀逛负MySQL绋嬪簭鎵€鍦ㄧ殑璺緞)
鏌ユ壘mysqld璺緞,渚嬪:
[[email protected] system]# which mysqld
/opt/mysql-5.7.18/bin/mysqld
閫氳繃systemctl鏂瑰紡鍚姩mysql5.7:
[[email protected] system]# systemctl start mysqld
妫€鏌ySQL杩愯鐘舵€?
[[email protected] system]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 6
Server version: 5.7.18-log MySQL Community Server (GPL)
鍏抽棴闃茬伀澧?
[[email protected] system]# systemctl stop firewalld.service
[[email protected] system]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
璁剧疆mysql鐨勫紑鏈哄惎鍔細
[[email protected] system]# systemctl enable mysqld
Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld.service to /usr/lib/systemd/system/mysqld.service.
[[email protected] system]# systemctl list-unit-files | grep mysqld
mysqld.service enabled
鍙栨秷mysql鐨勫紑鏈鸿嚜鍚姩:
[[email protected] system]# systemctl disable mysqld
Removed symlink /etc/systemd/system/multi-user.target.wants/mysqld.service.
[[email protected] system]# systemctl list-unit-files | grep mysqld
mysqld.service disabled
以上是关于linux涓嬪畨瑁卪ysql的主要内容,如果未能解决你的问题,请参考以下文章