当前位置:网站首页>Ubuntu手動安裝MySQL
Ubuntu手動安裝MySQL
2022-06-27 10:11:00 【知行】
從官網下載安裝包MySQL :: Download MySQL Community Server
解壓到/usr/local目錄下,重命名為mysql
然後在終端輸入以下命令:
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> cd mysql
shell> chown -R mysql . (別忘了最後有一個點,下同)
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
這句執行後如果報錯:
scripts/mysql_install_db: 244: ./bin/my_print_defaults: not found
Neither host 'ubuntu' nor 'localhost' could be looked up with
./bin/resolveip
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option
在終端輸入uname -a命令查看系統版本,如果結果為x86_64則說明系統是64比特的,是不是下載的安裝包不對了?到官網下載64比特版本的,把剛解壓到mysql目錄删掉,重新執行上面這一條語句
如果又報錯:./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
這說明少個東西,執行下面這條命令:
sudo apt-get install libaio-dev
安裝完成後再執行scripts/mysql_install_db --user=mysql這條語句
繼續執行後續命令:
shell> chown -R root .
shell> chown -R mysql data
好了,下面啟動:
sudo ./support-files/mysql.server start
# /usr/local/mysql/bin/mysqld_safe --user=mysql &
cd /usr/local/mysql/bin //進入 bin目錄
#mysql //運行mysq命令
如果沒有沒有啟動 或出現 Can't connect to local MySQL server through socket '/tmp/mysql.sock'
解决方法: #cd /usr/local/mysql/support-files //進入該目錄
#./mysql.server start //啟動即可 既可在生成/tmp/mysql.sock
如果/tmp/mysql.sock 無該文件存在,且mysql是處於開啟的狀態?
解决方法: #netstat -an | grep 3306 //查看 3306端口
#ps -ef | grep mysql // 查找 mysql 進程
# kill -9 進程號 //强制删除mysql的進程號
#./mysql.server start //啟動即可 既可在生成/tmp/mysql.sock
如果在任意路徑下如數mysql命令得到的無該命令咋辦呢?
解决方法:修改 /etc/profile 文件 在文件中加入
PATH=$PATH:/usr/local/mysql/bin/
export PATH (保存即可退出執行 source /etc/profile)
以上操作完全可以 在任意目錄執行# mysql 命令
如果想執行 service mysql start or restart stop 命令咋辦的? 在不能老#./mysql.server start
解决方法:將 mysql.server 複制一份到 /etc/rc.d/init.d 下並改名 mysql 或 建個連接文件
假設當前目錄為 /etc/rc.d/init.d
如: #cp /usr/local/mysql/support-files/mysql.server mysql (複制)
或 : #ln -s /usr/local/mysql/support-files/mysql.server mysql (建立連接文件)
完成以上操作即可 執行 service mysql start (or restart stop)
用如下命令修改MYSQL密碼
# /usr/local/mysql/bin/mysqladmin -u root password yourpassword //默認安裝密碼為空,為了安全你必須馬上修改
# chmod 700 /etc/init.d/mysql
# chkconfig --add mysqld
# chkconfig --level 345 mysql on //copy編譯目錄的一個脚本設置使mysql每次啟動都能自動運行
# service mysql start
# netstat -atln
//啟動mysql服務
//查看3306端口是否打開。要注意在防火牆中開放該端口。
可以用telnet localhost 3306來測試一下,如果有反應,那就錶明安裝成功了
?
边栏推荐
- 迪米特法则
- Une compréhension facile de la simplicité de la classification bayésienne du lissage laplacien
- R language plot visualization: plot to visualize the two-dimensional histogram contour map, add numerical labels on the contour lines, customize the label font color, and set the mouse hover display e
- JS array splicing "suggested collection"
- R language plot visualization: visualize the normalized histograms of multiple data sets, add density curve KDE to the histograms, set different histograms to use different bin sizes, and add edge whi
- 如何获取GC(垃圾回收器)的STW(暂停)时间?
- 【HCIE-RS复习思维导图】- STP
- border影响父元素的高度-解决方案
- 片刻喘息,美国电子烟巨头禁令推迟,可暂时继续在美销售产品
- 小哥凭“量子速读”绝技吸粉59万:看街景图0.1秒,“啪的一下”在世界地图精准找到!...
猜你喜欢

Oracle连接MySQL报错IM002

audiotrack与audioflinger

es 根据索引名称和索引字段更新值

通俗易懂理解樸素貝葉斯分類的拉普拉斯平滑

Es update values based on Index Names and index fields

QT运行显示 This application failed to start because it could not find or load the Qt platform plugin

三层架构中,数据库的设计在哪一层实现,不是在数据存储层吗?
![leetcode:522. Longest special sequence II [greed + subsequence judgment]](/img/43/9b17e9cb5fee9d14c2986a2141889d.png)
leetcode:522. Longest special sequence II [greed + subsequence judgment]

通俗易懂理解朴素贝叶斯分类的拉普拉斯平滑

Product strength benchmarking seal /model 3, with 179800 pre-sales of Chang'an dark blue sl03
随机推荐
On anchors in object detection
DNS standby server information, DNS server address (how many DNS preferred and standby are filled in)
[registration] infrastructure design: from architecture hot issues to industry changes | tf63
[hcie-rs review mind map] - STP
Freemarker
Location and solution of network connection failure of primary online mobile terminal Report
学习笔记之——数据集的生成
C# Any()和AII()方法
On June 23, the video address of station B in the third episode of rust chat room
【OpenCV 例程200篇】212. 绘制倾斜的矩形
es 根据索引名称和索引字段更新值
闭包的常见问题
torchvision. models._ utils. Intermediatelayergetter tutorial
C language learning day_ 05
Prometheus alarm process and related time parameter description
Record in detail the implementation of yolact instance segmentation ncnn
2021 CSP J2 entry group csp-s2 improvement group round 2 video and question solution
torch.utils.data.RandomSampler和torch.utils.data.SequentialSampler的区别
CPU design (single cycle and pipeline)
小哥凭“量子速读”绝技吸粉59万:看街景图0.1秒,“啪的一下”在世界地图精准找到!...