博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
php7+nginx下安装mysql5.7出现的一些问题及解决/以及一些mysql常用方法
阅读量:4101 次
发布时间:2019-05-25

本文共 2181 字,大约阅读时间需要 7 分钟。

一、无法启动mysql

问题描述:

输入net start mysql 

启动mysql (或打开windows服务手动启动mysql),在cmd里启动发现没法启动

解决:

    1、查看my.ini文件是否放在bin目录下

关于my.ini:

http://www.cnblogs.com/lmh2072005/p/5656392.html

    2、网上搜索了下发现是5.7版本才有这个问题,要在bin目录下手动初始化data目录

cd到bin目录下先初始化。

cmd命令框到bin目录下输入: mysqld --initialize-insecure自动生成无密码的root用户

最后:初始化后再运行net start mysql 成功启动mysql 。

二、登陆问题

设置密码后,cmd在bin目录下输入:

mysql -uroot -p回车即输入密码即可

mysql -utest -p报错

三、PHP连接MySQL报错:Fatal error: Call to undefined function mysql_connect()之解决方法

问题描述:

...
'; echo '到数据库的连接已经成功关闭';}?>

运行后报错,检查nginx成功运行,php7其他文件成功运行。

思考:查看报错信息发现是没有找到”mysql_connection”函数,其原因似乎是没有”php_mysql.dll”,但是怎么会没有这个dll呢。

查找网络有关信息,发现需要对

;extension=php_mysql.dll 

进行操作,但这个已经被php7删除。

解决:在php.ini中找到

;extension=mysqli

将引号“;”删除,及可正常运行。

四、一些常用的mysql指令(注意末尾有没有分号)

启动MySQL:net start mysql

停止mysql: net stop mysql

登陆MySQL: mysql -uroot -p

修改MySQL密码:

        1)、mysql -uroot -p

         2)、update mysql.user set authentication_string=password('你想输入的密码') where user='root' and Host ='localhost';

         3)、flush privileges;

查看数据表: show databases;

推出MySQL: q\;

其他命令:

List of all MySQL commands:
Note that all text commands must be first on line and end with
';'
(要以“;”结尾)
?  (\?) Synonym
for
`help'.
clear
(\c) Clear the current input statement.
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
ego (\G) Send
command
to mysql server, display result vertically.
exit
(\q) Exit mysql. Same as quit.
go (\g) Send
command
to mysql server.
help (\h) Display this help.
notee (\t) Don't write into outfile.
print (\p) Print current
command
.
prompt (\R) Change your mysql prompt.
 
 
quit (\q) Quit mysql.
 
rehash (\
#) Rebuild completion hash.
source
(\.) Execute an SQL script
file
. Takes a
file
name as an argument.
status (\s) Get status information from the server.
tee
(\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
charset (\C) Switch to another charset. Might be needed
for
processing binlog with multi-byte charsets.
warnings (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.
resetconnection(\x) Clean session context.
你可能感兴趣的文章
mysql update与group by
查看>>
nginx反代 499 502 bad gateway 和timeout
查看>>
linux虚拟机安装tar.gz版jdk步骤详解
查看>>
python猜拳游戏
查看>>
python实现100以内自然数之和,偶数之和
查看>>
python数字逆序输出及多个print输出在同一行
查看>>
python九九乘法表(详解)
查看>>
ESP8266 WIFI数传 Pixhaw折腾笔记
查看>>
苏宁产品经理面经
查看>>
百度产品经理群面
查看>>
去哪儿一面+平安科技二面+hr面+贝贝一面+二面产品面经
查看>>
element ui 弹窗在IE11中关闭时闪现问题修复
查看>>
vue 遍历对象并动态绑定在下拉列表中
查看>>
Vue动态生成el-checkbox点击无法选中的解决方法
查看>>
python __future__
查看>>
MySQL Tricks1
查看>>
python 变量作用域问题(经典坑)
查看>>
pytorch
查看>>
pytorch(二)
查看>>
pytorch(三)
查看>>