Need to access SQL using “mysql root -p”

Hey guys: I have one question access mysql using command line. I have no problem to access mysql based on this commend line “mysql –host=localhost –user=root –password=”mypassword””; however, I have issue access mysql using the conventional way: “mysql root -p”. I’ve tried many times to change root password. But I still only can access mysql using this commend line “mysql –host=localhost –user=root –password=”mypassword””. Any comments are welcoming!

Laravel $request->input() is getting url path together with the query param name

I am having a route which gets multiple records from a database. There are possible filters to be applied to it as query parameters. For example cid.
In my controller I am doing a $chosen_category = $request->input('cid', 0); and it gets it just right when working on localhost.
However when testing on a real domain, the first request param is broken, because it gets the whole path together with the name. So my variable always equals to the default (0).

Get absolute path of initially run script

I have searched high and low and get a lot of different solutions and variables containing info to get the absolute path. But they seem to work under some conditions and not under others. Is there one silver bullet way to get the absolute path of the executed script in PHP? For me, the script will run from the command line, but, a solution should function just as well if run within Apache etc.